Hi Daniel,

I have trouble doing this:

1. admin.site.unregister(User) does not remove User from the admin
interface. It is still visible. I removed all code and used only this
line and the import... line. Nothing happens.


2. Is this code correct?

from django.contrib import admin
from myproject.myapp.models import Car, Manufacturer, UserProfile
#UserProfile ist the extended Profile
from django.contrib.auth.admin import UserAdmin

admin.site.register(Manufacturer)
admin.site.register(Aeroplane)

class MyUserAdmin(UserAdmin):
    model = UserProfile

try:
    admin.site.unregister(User)
except admin.sites.NotRegistered:
    pass
admin.site.register(User, MyUserAdmin)


-LD


On Aug 17, 10:04 am, Daniel Roseman <dan...@roseman.org.uk> wrote:
> On Aug 17, 8:06 am, Léon Dignòn <leon.dig...@gmail.com> wrote:
>
> > Hello,
>
> > I use an extendedUserModel and like to display these fields in the
> >adminview at Auth/User. Can anybody show me how this works?
>
> > Thanks
>
> > -LD
>
> Create your ownadminclass for your extendedUsermodel, inheriting
> from the one in contrib.auth.admin. Then unregister the default one
> and register yours:
>
> from django.contrib.auth.adminimport UserAdmin
>
> class MyUserAdmin(UserAdmin(UserAdmin):
>    .... extended attributes here ...
>
> try:
>    admin.site.unregister(User)
> except exceptadmin.sites.NotRegistered:
>     passadmin.site.register(User, MyUserAdmin)
>
> --
> DR.
--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to