Missing inlines in Django Admin -
see below models.py/admin.py
when try change or add fashionmalemodel, inlines don't appear, in fashionfemalemodel. if change order in admin sites registered, putting male below female, inlines show in fashionmalemodel, , not fashionfemalemodel.
why inlines showing in 1 or other?
thanks!
i've truncated these models because there's lot. also, fashionobject/fashionpage base classes i've created part of custom cms id, name, publish_date, etc.
models.py:
class fashionmodelrole(models.model): title = models.charfield(max_length=255,) class fashionmodelcontributor(models.model): role = models.foreignkey(fashionmodelrole) person = models.foreignkey(fashionmodelperson, related_name='contributions') class fashionmodel(fashionobject): gender = models.charfield(max_length=1,choices=(('f','female'),('m','male')), editable=false) class fashionexperience(models.model): model = models.foreignkey(fashionmodel, related_name = 'experience') division = models.foreignkey(fashiondivision, related_name = 'levels') experience = models.charfield(max_length=1,choices=(('5','professional'),('4','advanced'),('3','intermediate'),('2','developing'),('1','recreational'),)) class fashionmalemodel(fashionmodel): jacket_size = measurementfield(max_length=6, blank=true, null=true) def __init__(self, *args, **kwargs): super(fashionmalemodel, self).__init__(*args, **kwargs) self.gender = 'm' class fashionfemalemodel(fashionmodel): dress_size = measurementfield(max_length=6, blank=true, null=true) def __init__(self, *args, **kwargs): super(fashionfemalemodel, self).__init__(*args, **kwargs) self.gender = 'f' class fashionmodelphoto(models.model): model = models.foreignkey(fashionmodel, related_name = 'photos') contributors = models.manytomanyfield(fashionmodelcontributor, null=true, blank=true)
admin.py:
class fashionexperienceinline(admin.tabularinline): model = fashionexperience class fashionmodelphotoinline(admin.tabularinline): model = fashionmodelphoto class fashiondivisionadmin(fashionpageadmin): def __init__(self, *args, **kwargs): super(fashiondivisionadmin, self).__init__(*args, **kwargs) class fashionmodeladmin(fashionobjectadmin): def __init__(self, *args, **kwargs): super(fashionmodeladmin, self).__init__(*args, **kwargs) self.inlines += ( fashionmodelphotoinline, fashionexperienceinline, ) class fashionmalemodeladmin(fashionmodeladmin): def __init__(self, *args, **kwargs): super(fashionmalemodeladmin, self).__init__(*args, **kwargs) class fashionfemalemodeladmin(fashionmodeladmin): def __init__(self, *args, **kwargs): super(fashionfemalemodeladmin, self).__init__(*args, **kwargs) class fashionmodelpersonadmin(admin.modeladmin): def __init__(self, *args, **kwargs): super(fashionmodelpersonadmin, self).__init__(*args, **kwargs) class fashionmodelroleadmin(admin.modeladmin): def __init__(self, *args, **kwargs): super(fashionmodelroleadmin, self).__init__(*args, **kwargs) class fashionmodelcontributoradmin(admin.modeladmin): def __init__(self, *args, **kwargs): super(fashionmodelcontributoradmin, self).__init__(*args, **kwargs) admin.site.register(fashionmalemodel, fashionmalemodeladmin) admin.site.register(fashionfemalemodel, fashionfemalemodeladmin) admin.site.register(fashiondivision, fashiondivisionadmin) admin.site.register(fashionmodelperson, fashionmodelpersonadmin) admin.site.register(fashionmodelrole, fashionmodelroleadmin) admin.site.register(fashionmodelcontributor, fashionmodelcontributoradmin)
i took out __init__
functions fashionmalemodeladmin , fashionfemalemodeladmin classes, defined inlines separately inside each one:
inlines = (fashionmodelphotoinline, fashionexperienceinline)
seems work. took @ this.
Comments
Post a Comment