[Fixed]-Django admin change_form with ajax query

1👍

Place your change_form.html in the below hierachy:

/myproject/templates/admin/myapp/mymodel/change_form.html

And inherit the base change_form.html from admin.
Eg:

{% 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 %}
👤pramod

Leave a comment