On Dec 3, 11:37 am, Logan Chow <[EMAIL PROTECTED]> wrote: > Thanks a lot, Rajesh. > Excuse me, but one more question: > When I edit/add the inherited class (for example: Student), > everything goes well but the password field. It is not user friendly. > So I try the following: > > from django.contrib.auth.admin import UserAdmin > admin.site.register(Student, UserAdmin) > > Then I try to add a new user again. It first shows a form request for > username and password (twice), after I fill them up and click on save. > An error come with "Student object with primary key u'7' does not > exist." > I found that, the new user has been created in admin/Users, but not in > Student.
The built-in UserAdmin has special code that deals with the password encryption flow for a new user account. Take a look at the code in /django/contrib/auth/admin.py. You will probably want to extend the UserAdmin class there with your own "StudentAdmin" class. You should also look at the add_form parameter there which uses a special form for the "Add User" action. You may have to extend that form as well. At this point, you should also consider simply copying over the entire django.contrib.auth.* code hierarchy into your own custom app and making your necessary extensions directly to those models instead of using the contrib.auth built-in application. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---