Hey, I'm fairly new to Django, and I'm looking to edit admin class variables dynamically (The full idea is to hide inlines on adding and only show on editing, but I'm distilling the issue here).
Could someone explain why this doesn't work?
class dbTablePermissionInline(admin.TabularInline):
model = dbPermission
class adminDbTable(admin.ModelAdmin):
inlines = [
dbTablePermissionInline,
]
def __init__(self, *args, **kwargs):
super(adminDbTable,self).__init__(*args, **kwargs)
self.inlines = []
when I throw an assert (assert False, self.inlines) above self.inlines = [] it correctly shows the inlines, but the inlines are still appearing? Even though I've emptied the list.
Helps appreciated! Thanks.