blechreiz-website/musicians/admin.py

33 lines
890 B
Python
Raw Normal View History

2013-05-28 15:20:06 +02:00
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 _
2013-06-30 11:01:12 +02:00
from musicians.models import Musician
# from eventplanner.admin import EventParticipationInline
2013-05-28 15:20:06 +02:00
# Define an inline admin descriptor for Musician model
# which acts a bit like a singleton
class MusicianInline(admin.StackedInline):
2013-05-28 15:20:06 +02:00
model = Musician
can_delete = False
verbose_name_plural = _('musicians')
verbose_name = _('musician')
# Define a new User admin
class UserAdmin(UserAdmin):
inlines = (MusicianInline,)
class MusicianAdmin(admin.ModelAdmin):
readonly_fields = ('user',)
# inlines = ( EventParticipationInline, )
model = Musician
2013-05-28 15:20:06 +02:00
# Re-register UserAdmin
admin.site.unregister(User)
2013-05-28 15:20:06 +02:00
admin.site.register(User, UserAdmin)
admin.site.register(Musician, MusicianAdmin)