Wednesday, July 31, 2013

Re: Using standard Django admin User forms for Custom User model?


On Wed, Jul 31, 2013 at 12:36 PM, Victor Hooi <victorhooi@gmail.com> wrote:
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.

Have you read the documentation on this issue? 


The docs discuss what you have to do in order to get your User model represented in the admin, and also provide a worked example.

If you've got a specific question that isn't covered by the docs, or if you're confused by what the docs say, let us know.

Yours,
Russ Magee %-)

--
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