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 # from eventplanner.admin import EventParticipationInline # 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,) class MusicianAdmin(admin.ModelAdmin): readonly_fields = ('user',) # inlines = ( EventParticipationInline, ) model = Musician # Re-register UserAdmin admin.site.unregister(User) admin.site.register(User, UserAdmin) admin.site.register(Musician, MusicianAdmin)