django-registration

django-registration creating blank django-profiles using signals

試著忘記壹切 提交于 2019-12-13 07:36:12
问题 I have gone through the solution here and Shacker's django-profiles: The Missing Manual and subsequent signals solution by Dmitko and answers here and many places. Here are the details: AUTH_PROFILE_MODULE = "members.Profile " From members.models.py class Profile(models.Model): """member model.""" GENDER_CHOICES = ( (1, 'Male'), (2, 'Female'), ) user = models.ForeignKey(User, unique=True) first_name = models.CharField(_('first name'), max_length=100) middle_name = models.CharField(_('middle

Django-Registration: How to prevent logged in user from registering?

﹥>﹥吖頭↗ 提交于 2019-12-13 02:44:31
问题 I've just started to use django-registration. I have two questions: How do you prevent a logged in user from going to the register page? How do you automatically sign in a user after activation? I prefer not changing any code in the app itself. For question 2, I've already read the docs where it says to write "a function which listens for the appropriate signal; your function should set the backend attribute of the user to the correct authentication backend, and then call django.contrib.auth

first_name and last_name not saving in custom Django_Registration form

半腔热情 提交于 2019-12-13 02:03:40
问题 I am having trouble getting the first_name and last_name variables to save once the user has submitted the form. Here is my code.I need help. Models.py from django.db import models from django.contrib.auth.models import User class MyRegistration(models.Model): first_name = models.CharField(max_length = 100, null = True, unique = True) last_name = models.CharField(max_length = 100, null = True, unique = True) def __unicode__(self): return self.name Forms.py from registration.forms import

How to use different form in Django-Registration

点点圈 提交于 2019-12-12 08:00:51
问题 Django-Registration has several form classes in the forms.py file. One is "class RegistrationFormTermsOfService(RegistrationForm) .. What do I change in the rest of Django Registration code to enable this form in my registration flow instead of RegistrationForm? 回答1: You can simply go into your urls.py and override the form class by doing something like: from registration.forms import RegistrationFormTermsOfService (r'^accounts/register/$', 'registration.views.register', {'form_class' :

Custom user models in Django: `no such table: auth_user`

强颜欢笑 提交于 2019-12-12 02:19:15
问题 According to the answer to my previous question, I edited the django-registration module with the following modifications: in myapp/models.py : from django.contrib.auth.models import UserManager from django.contrib.auth.models import AbstractUser class AccountManager(UserManager): def create_user(self, email, password=None, **kwargs): if not email: raise ValueError('Users must have a valid email address.') if not kwargs.get('username'): raise ValueError('Users must have a valid username.')

Why does the signal not trigger?

浪尽此生 提交于 2019-12-11 07:15:46
问题 Sitting over a day on it. Really can't understand why this signal is not triggered when a user is activated, no error log, no exception in the admin on activation. Can anybody help? The following code should result in a log message in the apache error.log when a user, right? import logging from django.dispatch import receiver from registration.signals import user_activated @receiver(user_activated) def registered_callback(sender, **kwargs): logger = logging.getLogger("user-activated") logger

Django-Registration: Overriding the default fields

孤街醉人 提交于 2019-12-11 06:49:15
问题 Yesterday I faced a problem trying to override the RegistrationForm of Django-Registration app. The class RegistrationForm inherit from UserCreationForm of Django, which is based on ModelForm , so I created my custom class inheriting from RegistrationForm in this way: from django import forms from django.contrib.auth.models import User class MyRegistrationForm(RegistrationForm): class Meta: model = User fields = ('username', 'email', 'password1', 'password2') widgets = { 'username': forms

How to over-ride default registration form in Django-Registration version 1.0?

杀马特。学长 韩版系。学妹 提交于 2019-12-11 05:46:11
问题 I'm migrating from an older version of Django-Registration to the 1.0 version of the module. I'm overriding the normal registration form with a custom one that I have created. This behavior has stopped working with Django-registration 1.0 and I'm trying to get it working again. But have not been successful so far. This is what my urls.py file looks like: from registration.views import RegistrationView from myApp.forms import * <...SNIPPED...> url ( r'^accounts/register/$', RegistrationView.as

How to redirect people after they register using django registration

ⅰ亾dé卋堺 提交于 2019-12-11 02:59:44
问题 url(r'^register/$', RegistrationView.as_view(form_class=CustomRegistrationForm, success_url='/profile'), name='registration_register', success_url='/profile'), I have the following in my urls.py. How do I redirect people after they register using django registration 1.0? 回答1: The redirect will be issued to the path specified by RegistrationView.get_success_url , which should be RegistrationView.success_url which you've specified when constructing the view function. You can review RequestView

django-registration app and Django 1.5 custom user model

倖福魔咒の 提交于 2019-12-10 01:50:14
问题 I use django-registration app and Django 1.5. How to create (new in django) custom user model and save also this data during registration (Please note that I am using django-registration): class CustomProfile(models.Model): user = models.ForeignKey(User) name = models.CharField(max_length=255) bank = models.CharField(max_length=255) address = models.CharField(max_length=255) ? 回答1: django-registration's main fork is not compatible with django 1.5 for now. Check this pull request. You have