Tuesday, July 30, 2013

Using standard Django admin User forms for Custom User model?

Hi,

When you add a Django User through the admin, it presents you with a initial screen to enter a username and password  (/admin/auth/user/add/), and then handles hashing for you.

Also, when you go to edit a User, it gives you a Change Password form (e.g. /admin/auth/user/2/password/)

I'm using a custom user model in my Django app, by inheriting from AbstractCustomer.

If I add this to the admin now, password is just a standard textbox, and obviously if I create a user through that, I can't login since I assume it's not hashing the password.

Is there any way I can use the normal Django User admin forms with a custom User model?

Secondly, I tried creating a user via the create_user() method on my custom User object - I still wasn't able to login to the admin using that username/password, which I thought was weird.

Cheers,
Victor

--
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.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment