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?
Thanks to the comments for a change in 1.4. My implementation here wasn’t thread safe either, so it really should have been deleted.
Since
get_formsetsis passed the object and callsget_inline_instances, we can modify both functions to act on the object.This should work: