[django-users] Error when registering a new user - Django 1.5
Hi,
My code is very simple:
I think that UserCreationForm yet search for auth_user table.
-- 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 280
BRT 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'
# models.py
class User(AbstractUser):
bio = models.CharField(max_length=255, blank=True, null=True)
objects = UserManager()
# forms.py
class UserCreateForm(UserCreationForm):
class Meta:
model = get_user_model()
fields = ('email', 'password1', 'password2', 'first_name', 'last_name', 'bio', 'username')
# views.py
class UserCreateView(CreateView):
form_class = UserCreateForm
model = get_user_model()
A possible solution would be this:
# models.py
class 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