1. Dave LeBlanc
  2. Django Nested Inlines
  3. Issues
Issue #3 new

NestedStackedInline is not shown when using it with UserProfile

caoqinghua
created an issue

thanks a lot for the great work!

I used you patch to Django 1.3.1 and use it for my UserProfile inline admin. But the InlineAdmin is not shown in UserAdmin form, and with no error.

do you need more information?

{{{

!python

class ContactInfoInline(admin.StackedInline):
model = UserProfile.contact_info.through
extra = False

class UserProfileAdmin(admin.ModelAdmin):
list_display = ('unicode', 'pk', 'information',)
search_fields = ('pk',)
fieldsets = (
( 'standard info', {'fields' : ('employee_num', 'identity_num') }),
( 'more info', {'fields' : ('information', ), 'classes' : ['collapse']}),
)
inlines = [
ContactInfoInline,
]
readonly_fields = ['unicode']

class ProfileInline(admin.StackedInline):
model = UserProfile
fk_name = 'user'
max_num = 1

class CustomUserAdmin(UserAdmin):
list_display = ('username', 'display_department', 'email', )
inlines = [ProfileInline,]
def display_department(self, obj):
return obj.get_profile.department

admin.site.unregister(User)
admin.site.register(User, CustomUserAdmin)
}}}

Comments (1)

  1. Log in to comment