[Django]-How to access model data when overriding Django admin templates?

4๐Ÿ‘

โœ…

{{ form.instance }} will always be the model instance associated with a modelform, assuming there is one.

(Note that โ€œ{{ formset.instance }}` is the instance of the parent model in an inline formset).

๐Ÿ‘คDaniel Roseman

6๐Ÿ‘

In Django 2.1 {{adminform.form.instance.field_name}} worked for me.

๐Ÿ‘คK. Stopa

Leave a comment