[Fixed]-Django Override Admin change_form.html Template โ€“ display associated model in template

21๐Ÿ‘

โœ…

Looks like I found a means to do this using this syntax.

{% extends "admin/change_form.html" %}
{% block after_field_sets %}{{ block.super }}
Print my model here {{ original }}
Print foreignkey related records of my model:
{% for item in original.items_set.all %} {{ item }} {% endfor %}
{% endblock %}

Sorry to answer so soon, but thanks to anyone who started researching. Perhaps someone will find this helpful. If you see a better way to do this, feel free to comment.

๐Ÿ‘คJoe J

19๐Ÿ‘

Just poking around, it seems that {{adminform.form.instance}} works.

๐Ÿ‘คfooo

Leave a comment