blechreiz-website/musicians/admin.py

30 lines
777 B
Python

from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
from django.utils.translation import ugettext as _
from musicians.models import Musician, PhoneNumber
class PhoneNumberInline( admin.TabularInline ):
model = PhoneNumber
extra = 3
# Define an inline admin descriptor for Musician model
# which acts a bit like a singleton
class MusicianInline( admin.StackedInline ):
model = Musician
can_delete = False
verbose_name_plural = _('musicians')
verbose_name = _('musician')
# Define a new User admin
class UserAdmin( UserAdmin ):
inlines = (MusicianInline, PhoneNumberInline )
# Re-register UserAdmin
admin.site.unregister( User )
admin.site.register(User, UserAdmin)