Re: [django-users] Error when registering a new user - Django 1.5
I did it and aparently it worked:
From: https://groups.google.com/forum/?fromgroups=#!topic/django-users/kOVEy9zYn5c
Should not it be the UserCreationForm standard?
# forms.py
class UserCreateForm(UserCreationForm):
def clean_username(self):
username = self.cleaned_data["username"]
try:
self._meta.model._default_manager.get(username=username)
except self._meta.model.DoesNotExist:
return username
raise forms.ValidationError(self.error_messages['duplicate_username'])
class Meta:
model = get_user_model()
fields = ('email', 'password1', 'password2', 'first_name', 'last_name', 'bio', 'username')
Should not it be the UserCreationForm standard?
2013/3/23 Leonardo S <leonardo.s.comm@gmail.com>
Hi,I am getting an error when registering a new user in a Django 1.5 app.It is the postgres' log:BRT ERROR: relation "auth_user" does not exist at character 280BRT COMMAND: SELECT "auth_user"."id", "auth_user"."password", "auth_user"."last_login", "auth_user"."is_superuser", "auth_user"."username", "auth_user"."first_name", "auth_user"."last_name", "auth_user"."email", "auth_user"."is_staff", "auth_user"."is_active", "auth_user"."date_joined" FROM "auth_user" WHERE "auth_user"."username" = E'teste'My code is very simple:
# models.pyclass User(AbstractUser):bio = models.CharField(max_length=255, blank=True, null=True)objects = UserManager()# forms.pyclass UserCreateForm(UserCreationForm):class Meta:model = get_user_model()fields = ('email', 'password1', 'password2', 'first_name', 'last_name', 'bio', 'username')# views.pyclass UserCreateView(CreateView):form_class = UserCreateFormmodel = get_user_model()I think that UserCreationForm yet search for auth_user table.A possible solution would be this:# models.pyclass User(AbstractUser):bio = models.CharField(max_length=255, blank=True, null=True)objects = UserManager()class Meta:db_table = u'auth_user'But i would like to use a correct Django 1.5 approach to register a new user.Can anyone spot the problem?
Regards,
Leonardo
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home