Creating custom users in Django and customizing the admin -


i need create custom users in app.

in the example given in doc

class customuser(models.model):     user = models.onetoonefield(user)     #custom fields 

a user must exists before creating customuser.

what want create automatically user when create customuser.

in customuser admin (only visible superuser), i'd have custom fields , few fields user model, form allow superuser change password existing instance.

anybody help?

the first part of question easy, can use signal:

def create_custom_user(sender, instance, created, **kwargs):     if created:         custom_user, created = customuser.objects.get_or_create(user=instance)  post_save.connect(create_custom_user, sender=user) 

as second part, theres change password form in admin. filter out displayed fields can create customuseradmin , register model. it's pretty self explaining in django docs.

django docs: list_display


Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -