Skip to content

Commit

Permalink
feat: changelist before after templates (#776)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasvinclav committed Sep 30, 2024
1 parent 884ec85 commit cde3771
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 @@ -235,6 +235,8 @@ class ModelAdmin(ModelAdminMixin, BaseModelAdmin):
list_filter_submit = False
list_fullwidth = False
list_disable_select_all = False
list_before_template = None
list_after_template = None
change_form_before_template = None
change_form_after_template = None
compressed_fields = False
Expand Down
8 changes: 8 additions & 0 deletions src/unfold/templates/admin/change_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@
{% endif %}
{% endblock %}

{% if cl.model_admin.list_before_template %}
{% include cl.model_admin.list_before_template %}
{% endif %}

<form id="changelist-form" method="post"{% if cl.formset and cl.formset.is_multipart %} enctype="multipart/form-data"{% endif %} novalidate>
{% csrf_token %}

Expand Down Expand Up @@ -109,6 +113,10 @@
{% endblock %}
</form>

{% if cl.model_admin.list_after_template %}
{% include cl.model_admin.list_after_template %}
{% endif %}

{% if cl.has_filters %}
{% include "unfold/change_list_filter.html" %}
{% endif %}
Expand Down

0 comments on commit cde3771

Please sign in to comment.