django-registration

Django-nonrel + Django-registration problem: unexpected keyword argument 'uidb36' when resetting password

本秂侑毒 提交于 2019-11-27 10:55:10
问题 I'm using Django-nonrel with registration app. Things seem to be working fine, except when I try to reset my password. When clicking on reset-password link sent to me in email, Django produces error message: password_reset_confirm() got an unexpected keyword argument 'uidb36' My question: has anybody seen it and knows what's the cure? EDIT: The problem is caused by registration\auth_urls.py - they duplicate entries in django\contrib\auth\urls.py, circumwenting patched version of the file in

Not able to add custom fields to django-registration

為{幸葍}努か 提交于 2019-11-27 06:32:31
问题 I extended RegistrationFormUniqueEmail class CustomRegistrationFormUniqueEmail(RegistrationFormUniqueEmail): first_name = forms.CharField(label=_('First name'), max_length=30,required=True) last_name = forms.CharField(label=_('Last name'), max_length=30, required=True) def save(self, profile_callback=None): new_user = super(CustomRegistrationFormUniqueEmail, self).save(profile_callback=profile_callback) new_user.first_name = self.cleaned_data['first_name'] new_user.last_name = self.cleaned

Django - Create user profile on user creation

六月ゝ 毕业季﹏ 提交于 2019-11-27 03:09:01
问题 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

Removing help_text from Django UserCreateForm

杀马特。学长 韩版系。学妹 提交于 2019-11-27 02:08:16
问题 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

Python/Django django-registration add an extra field

旧城冷巷雨未停 提交于 2019-11-27 01:42:48
问题 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

Get user information in django templates

懵懂的女人 提交于 2019-11-27 01:28:29
问题 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 回答1: 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

django+ send email in html with django-registration

萝らか妹 提交于 2019-11-27 00:24:51
问题 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 回答1: I'd recommend sending both a text version and an

CSRF verification failed. Request aborted. on django

怎甘沉沦 提交于 2019-11-26 16:31:13
问题 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

Creating a extended user profile

99封情书 提交于 2019-11-26 14:56:37
I have an extended UserProfile model in django: class UserProfile(models.Model): user = models.ForeignKey(User, unique=True) #other things in that profile And a signals.py: from registration.signals import user_registered from models import UserProfile from django.contrib.auth.models import User def createUserProfile(sender, instance, **kwargs): profile = users.models.UserProfile() profile.setUser(sender) profile.save() user_registered.connect(createUserProfile, sender=User) I make sure the signal gets registered by having this in my __init__.py : import signals So that should create me a new

Creating a extended user profile

梦想与她 提交于 2019-11-26 04:06:41
问题 I have an extended UserProfile model in django: class UserProfile(models.Model): user = models.ForeignKey(User, unique=True) #other things in that profile And a signals.py: from registration.signals import user_registered from models import UserProfile from django.contrib.auth.models import User def createUserProfile(sender, instance, **kwargs): profile = users.models.UserProfile() profile.setUser(sender) profile.save() user_registered.connect(createUserProfile, sender=User) I make sure the