I have a model that I want staff to be able to edit up to the date for the event. Like this:
class ThingAdmin(admin.ModelAdmin):
model = Thing
if obj.da
I had a complex case where the solutions I tried failed in unexpected ways (problems with readonly fields in inlines). This is the most clear and failsafe way I've found:
class MyAdmin(admin.ModelAdmin):
def add_view(self, request, form_url='', extra_context=None):
self.inlines = [InlineA, InlineC]
return super(MyAdmin, self).add_view(request, form_url, extra_context)
def change_view(self, request, object_id, form_url='', extra_context=None):
self.inlines = [InlineB, InlineC, InlineD]
return super(MyAdmin, self).change_view(request, object_id, form_url, extra_context)
This is working in Django 1.4.x.