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.date < today: #Something like that
inlines = [MyInline,]
The problem is, I don't have access to the obj instance at this level. I've tried overriding get_formset(), but didn't get anywhere.
Please advise?
The most turnkey way to do this now is to override and super call to get_inline_instances.
This puts MyInline in when you want it and not when you don't. If you know the only inline you have in your class is MyInline, you can make it even simpler: