Tuesday, January 29, 2013

extended Admin User

Hi,

i created an extended admin User and modified the fieldsets for the admin interface. Everything works fine, BUT how can i get the groupselection and permission fields in my admin interface?
I hope you have a short hint.

Additional Question: When i have an inline element with meta option "extra" - how can i switch of the "#1", "#2" numbers displayed in my admin interface?

Greets Dominik
 
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin, GroupAdmin
from django.contrib.auth.models import User, Group
from members.models import Member

class MemberInline(admin.StackedInline):
    model = Member
    can_delete = False
    verbose_name_plural = 'Adresse'
    fieldsets = (
                 (None, {'fields':('street','zipcode','city','phone','avatar')}),
                 ('Mitgliedschaft', {'fields': ('newsletter','member_since')}),
                 )
    extra = 1
      

    
class MyUserAdmin(UserAdmin):
    list_display = ('username','email','first_name','last_name')
    list_filter =()
    fieldsets = (
                 (None, {'fields': ('username','first_name','last_name','email','password')}),
                 )
    inlines = [MemberInline]

    

admin.site.unregister(User)
admin.site.register(User, MyUserAdmin)

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

No comments:

Post a Comment