Skip to content

Commit

Permalink
feat: changeform outer form templates (#891)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasvinclav authored Dec 3, 2024
1 parent 0746682 commit f6c9fc0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/unfold/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@ class ModelAdmin(ModelAdminMixin, BaseModelAdmin):
list_after_template = None
change_form_before_template = None
change_form_after_template = None
change_form_outer_before_template = None
change_form_outer_after_template = None
compressed_fields = False
readonly_preprocess_fields = {}
warn_unsaved_form = False
Expand Down
8 changes: 8 additions & 0 deletions src/unfold/templates/admin/change_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@
<div id="content-main">
{% block form_before %}{% endblock %}

{% if adminform.model_admin.change_form_outer_before_template %}
{% include adminform.model_admin.change_form_outer_before_template %}
{% endif %}

<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>
{% csrf_token %}

Expand Down Expand Up @@ -116,6 +120,10 @@
</div>
</form>

{% if adminform.model_admin.change_form_outer_after_template %}
{% include adminform.model_admin.change_form_outer_after_template %}
{% endif %}

{% block form_after %}{% endblock %}
</div>
{% endblock %}

0 comments on commit f6c9fc0

Please sign in to comment.