Skip to content

Commit f6c9fc0

Browse files
authored
feat: changeform outer form templates (#891)
1 parent 0746682 commit f6c9fc0

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/unfold/admin.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,8 @@ class ModelAdmin(ModelAdminMixin, BaseModelAdmin):
240240
list_after_template = None
241241
change_form_before_template = None
242242
change_form_after_template = None
243+
change_form_outer_before_template = None
244+
change_form_outer_after_template = None
243245
compressed_fields = False
244246
readonly_preprocess_fields = {}
245247
warn_unsaved_form = False

src/unfold/templates/admin/change_form.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@
6161
<div id="content-main">
6262
{% block form_before %}{% endblock %}
6363

64+
{% if adminform.model_admin.change_form_outer_before_template %}
65+
{% include adminform.model_admin.change_form_outer_before_template %}
66+
{% endif %}
67+
6468
<form {% if has_file_field %}enctype="multipart/form-data" {% endif %}{% if form_url %}action="{{ form_url }}" {% endif %}method="post" id="{{ opts.model_name }}_form" {% if adminform.model_admin.warn_unsaved_form %}class="warn-unsaved-form"{% endif %} novalidate>
6569
{% csrf_token %}
6670

@@ -116,6 +120,10 @@
116120
</div>
117121
</form>
118122

123+
{% if adminform.model_admin.change_form_outer_after_template %}
124+
{% include adminform.model_admin.change_form_outer_after_template %}
125+
{% endif %}
126+
119127
{% block form_after %}{% endblock %}
120128
</div>
121129
{% endblock %}

0 commit comments

Comments
 (0)