Skip to content

Commit cde3771

Browse files
authored
feat: changelist before after templates (#776)
1 parent 884ec85 commit cde3771

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
@@ -235,6 +235,8 @@ class ModelAdmin(ModelAdminMixin, BaseModelAdmin):
235235
list_filter_submit = False
236236
list_fullwidth = False
237237
list_disable_select_all = False
238+
list_before_template = None
239+
list_after_template = None
238240
change_form_before_template = None
239241
change_form_after_template = None
240242
compressed_fields = False

src/unfold/templates/admin/change_list.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@
6969
{% endif %}
7070
{% endblock %}
7171

72+
{% if cl.model_admin.list_before_template %}
73+
{% include cl.model_admin.list_before_template %}
74+
{% endif %}
75+
7276
<form id="changelist-form" method="post"{% if cl.formset and cl.formset.is_multipart %} enctype="multipart/form-data"{% endif %} novalidate>
7377
{% csrf_token %}
7478

@@ -109,6 +113,10 @@
109113
{% endblock %}
110114
</form>
111115

116+
{% if cl.model_admin.list_after_template %}
117+
{% include cl.model_admin.list_after_template %}
118+
{% endif %}
119+
112120
{% if cl.has_filters %}
113121
{% include "unfold/change_list_filter.html" %}
114122
{% endif %}

0 commit comments

Comments
 (0)