[Django]-How to access inline data in django ModelAdmin

6👍

save_related can do this, although it’s called after the form is saved so you’ll end up saving the object twice. You can access the object as form.instance or formset.instance.

def save_related(self, request, form, formsets, change):
    obj = form.instance
    # whatever your formset dependent logic is to change obj.filedata
    obj.save()
    super(ExampleAdmin, self).save_related(request, form, formsets, change)

Leave a comment