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 think the easiest way to hack this is to call your custom funciton in get_fields, or get_fieldsets
and so on, just set self.inlines
in a custom function.
class XXXAdmin(admin.ModelAdmin):
def set_inlines(self, request, obj):
""" hack inlines models according current request.user or obj """
self.inlines = []
if request.user.is_superuser or request.user is obj.recorder:
self.inlines = [AbcInline, ]
def get_fields(self, request, obj=None):
self.set_inlines(request, obj) # NOTICE this line
super(XXXAdmin, self).get_fields(request, obj)