django-registration

Extending django-registration using signals

喜夏-厌秋 提交于 2019-11-28 18:28:52
I have found here on stackoverflow a solution to extend django-registration with new fields using signals. Here's the link : http://dmitko.ru/?p=546 . I have created extended profile model, extended form, added required options to settings , defined urls and the proper form is displayed but only normal User (from auth module) is created. Why is that happening ? account.models : from django.db import models from django.contrib.auth.models import User from registration.signals import user_registered import hashlib class InheritedProfile(models.Model): first_name = models.CharField("Name", max

Django - Create user profile on user creation

こ雲淡風輕ζ 提交于 2019-11-28 09:42:33
I'm following Django documentation here in order to achieve a simple objective: Create a user profile as soon as a new user is created. I have an 'accounts' app and my accounts.models looks like this: # -*- coding: utf-8 -*- from django.db import models from django.db.models.signals import post_save from django.contrib.auth.models import User from main.models import Store class UserProfile(models.Model): GENRE_CHOICES = ( ('m', 'Masculino'), ('f', 'Feminino'), ) MARITAL_STATUS_CHOICES = ( ('s', 'Solteiro'), ('c', 'Casado'), ('d', 'Divorciado'), ('v', 'Viúvo'), ) user = models.ForeignKey(User,

Removing help_text from Django UserCreateForm

隐身守侯 提交于 2019-11-28 08:19:07
Probably a poor question, but I'm using Django's UserCreationForm (slightly modified to include email), and I would like to remove the help_text that Django automatically displays on the HTML page. On the Register portion of my HTML page, it has the Username, Email, Password1 & Password 2 fields. But underneath Username is "Required. 30 characters or fewer. Letters, digits, and @... only." And under Password Confirmation (Password 2), it says "Enter the same password as above for verification." How do I remove these? #models.py class UserCreateForm(UserCreationForm): email = forms.EmailField

Python/Django django-registration add an extra field

老子叫甜甜 提交于 2019-11-28 07:51:46
I have read a lot about how to add an extra field when using Django-registration, for example here , here and here . The code snippets are: forms.py (from the registration app) class RegistrationForm(forms.Form): username = forms.RegexField(regex=r'^\w+$', max_length=30, widget=forms.TextInput(attrs=attrs_dict), label=_("Username"), error_messages={ 'invalid': _("This value must contain only letters, numbers and underscores.") }) email = forms.EmailField(widget=forms.TextInput(attrs=dict(attrs_dict, maxlength=75)), label=_("Email")) password1=forms.CharField(widget=forms.PasswordInput(attrs

Get user information in django templates

落爺英雄遲暮 提交于 2019-11-28 06:44:40
What's the best way to get user information from a django template? For example, if I just want to: If the user is logged in, display "Welcome [username]" Otherwise, display the login button. I'm using django-registration/authentication An alternate method for current Django versions: {% if user.is_authenticated %} <p>Welcome, {{ user.get_username }}. Thanks for logging in.</p> {% else %} <p>Welcome, new user. Please log in.</p> {% endif %} Note: Use request.user.get_username() in views & user.get_username in templates. Preferred over referring username attribute directly. Source This template

Django Registration Redux: how to change the unique identifier from username to email and use email as login

痴心易碎 提交于 2019-11-28 05:35:00
问题 I'm using django-registration-redux in my project for user registration. It uses default User model which use username as the unique identifier. Now we want to discard username and use email as the unique identifier. And also we want to use email instead of username to login. How to achieve this? And is it possible to do it without changing the AUTH_USER_MODEL settings? Because from the official doc it says If you intend to set AUTH_USER_MODEL , you should set it before creating any

django+ send email in html with django-registration

巧了我就是萌 提交于 2019-11-28 04:25:42
im using django-registration, all is fine, the confirmation email was sending in plain text, but know im fixed and is sending in html, but i have a litter problem... the html code is showing: <a href="http://www.example.com/accounts/activate/46656b86eefc490baf4170134429d83068642139/">http://www. example.com/accounts/activate/46656b86eefc490baf4170134429d83068642139/</a> and i dont need to show the html code like the ... Any idea? Thanks I'd recommend sending both a text version and an html version. Look in the models.py of the django-registration for : send_mail(subject, message, settings

django-registration-redux add extra field

梦想与她 提交于 2019-11-27 15:36:09
问题 7 and python 2.7. i want to add extra field in django registration. i try to extend with my model like this: class Seller(models.Model): user = models.ForeignKey(User, unique=True) name = models.CharField(max_length=25) phone_number = models.BigIntegerField() email = models.EmailField(max_length=75) def __str__(self): return self.name; and i add form.py like this from django import forms from registration.forms import RegistrationForm from django.forms import ModelForm from django.contrib

CSRF verification failed. Request aborted. on django

。_饼干妹妹 提交于 2019-11-27 14:16:52
I am following Django 1.3 Web Development. and for logins, i am getting the following error Forbidden (403) CSRF verification failed. Request aborted. Help Reason given for failure: CSRF token missing or incorrect. This is my settings.py Included APPS. It is exactly how the book says it should be. INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', # Uncomment the next line to enable the admin: 'django.contrib.admin', # Uncomment the next line to enable admin

Extending django-registration using signals

北城以北 提交于 2019-11-27 11:23:48
问题 I have found here on stackoverflow a solution to extend django-registration with new fields using signals. Here's the link : http://dmitko.ru/?p=546 . I have created extended profile model, extended form, added required options to settings , defined urls and the proper form is displayed but only normal User (from auth module) is created. Why is that happening ? account.models : from django.db import models from django.contrib.auth.models import User from registration.signals import user