django-unfold 0.39.0__py3-none-any.whl → 0.41.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. django_unfold-0.41.0.dist-info/METADATA +74 -0
  2. {django_unfold-0.39.0.dist-info → django_unfold-0.41.0.dist-info}/RECORD +53 -50
  3. {django_unfold-0.39.0.dist-info → django_unfold-0.41.0.dist-info}/WHEEL +1 -1
  4. unfold/admin.py +7 -0
  5. unfold/contrib/filters/forms.py +2 -2
  6. unfold/contrib/forms/templates/unfold/forms/array.html +2 -2
  7. unfold/contrib/guardian/templates/admin/guardian/model/obj_perms_manage.html +1 -1
  8. unfold/contrib/guardian/templates/admin/guardian/model/obj_perms_manage_group.html +1 -1
  9. unfold/contrib/guardian/templates/admin/guardian/model/obj_perms_manage_user.html +1 -1
  10. unfold/contrib/guardian/templates/unfold/guardian/group_form.html +2 -2
  11. unfold/contrib/guardian/templates/unfold/guardian/user_form.html +3 -3
  12. unfold/contrib/import_export/templates/admin/import_export/export.html +1 -1
  13. unfold/contrib/import_export/templates/admin/import_export/import.html +1 -1
  14. unfold/contrib/simple_history/templates/simple_history/object_history_form.html +1 -1
  15. unfold/forms.py +7 -8
  16. unfold/sites.py +12 -0
  17. unfold/static/admin/js/inlines.js +439 -0
  18. unfold/static/unfold/css/styles.css +1 -1
  19. unfold/static/unfold/fonts/material-symbols/Material-Symbols-Outlined.woff2 +0 -0
  20. unfold/static/unfold/fonts/material-symbols/styles.css +1 -2
  21. unfold/static/unfold/js/alpine.sort.js +1 -0
  22. unfold/static/unfold/js/app.js +36 -10
  23. unfold/static/unfold/js/select2.init.js +1 -1
  24. unfold/styles.css +5 -1
  25. unfold/templates/admin/app_index.html +1 -1
  26. unfold/templates/admin/app_list.html +1 -1
  27. unfold/templates/admin/auth/user/change_password.html +1 -1
  28. unfold/templates/admin/base.html +1 -1
  29. unfold/templates/admin/change_form.html +1 -1
  30. unfold/templates/admin/change_list.html +48 -38
  31. unfold/templates/admin/delete_confirmation.html +4 -9
  32. unfold/templates/admin/delete_selected_confirmation.html +4 -8
  33. unfold/templates/admin/edit_inline/stacked.html +68 -66
  34. unfold/templates/admin/edit_inline/tabular.html +143 -134
  35. unfold/templates/admin/login.html +2 -0
  36. unfold/templates/admin/object_history.html +1 -1
  37. unfold/templates/admin/submit_line.html +8 -8
  38. unfold/templates/registration/password_change_done.html +1 -1
  39. unfold/templates/registration/password_change_form.html +1 -1
  40. unfold/templates/unfold/change_list_filter.html +7 -9
  41. unfold/templates/unfold/components/button.html +4 -3
  42. unfold/templates/unfold/components/card.html +1 -1
  43. unfold/templates/unfold/components/progress.html +15 -15
  44. unfold/templates/unfold/components/separator.html +1 -1
  45. unfold/templates/unfold/helpers/app_list.html +2 -2
  46. unfold/templates/unfold/helpers/delete_submit_line.html +11 -0
  47. unfold/templates/unfold/helpers/display_header.html +8 -3
  48. unfold/templates/unfold/helpers/field_readonly_value.html +1 -1
  49. unfold/templates/unfold/helpers/fieldset_row.html +2 -0
  50. unfold/templates/unfold/helpers/welcomemsg.html +1 -1
  51. unfold/templates/unfold/layouts/skeleton.html +1 -0
  52. unfold/templates/unfold/widgets/url.html +7 -5
  53. django_unfold-0.39.0.dist-info/METADATA +0 -70
  54. {django_unfold-0.39.0.dist-info → django_unfold-0.41.0.dist-info}/LICENSE.md +0 -0
@@ -12,6 +12,21 @@ window.addEventListener("load", (e) => {
12
12
  warnWithoutSaving();
13
13
  });
14
14
 
15
+ /*************************************************************
16
+ * Alpine.sort.js callback after sorting
17
+ *************************************************************/
18
+ const sortRecords = (e) => {
19
+ const orderingField = e.from.dataset.orderingField;
20
+
21
+ const weightInputs = Array.from(
22
+ e.from.querySelectorAll(`.has_original input[name$=-${orderingField}]`)
23
+ );
24
+
25
+ weightInputs.forEach((input, index) => {
26
+ input.value = index;
27
+ });
28
+ };
29
+
15
30
  /*************************************************************
16
31
  * Warn without saving
17
32
  *************************************************************/
@@ -120,15 +135,26 @@ const dateTimeShortcutsOverlay = () => {
120
135
  * File upload path
121
136
  *************************************************************/
122
137
  const fileInputUpdatePath = () => {
123
- Array.from(document.querySelectorAll("input[type=file]")).forEach((input) => {
124
- input.addEventListener("change", (e) => {
125
- const parts = e.target.value.split("\\");
126
- const placeholder =
127
- input.parentNode.parentNode.parentNode.querySelector(
128
- "input[type=text]"
129
- );
130
- placeholder.setAttribute("value", parts[parts.length - 1]);
131
- });
138
+ const observer = new MutationObserver((mutations) => {
139
+ for (const mutation of mutations) {
140
+ if (mutation.type === "childList") {
141
+ for (const input of document.querySelectorAll("input[type=file]")) {
142
+ input.addEventListener("change", (e) => {
143
+ const parts = e.target.value.split("\\");
144
+ const placeholder =
145
+ input.parentNode.parentNode.parentNode.querySelector(
146
+ "input[type=text]"
147
+ );
148
+ placeholder.setAttribute("value", parts[parts.length - 1]);
149
+ });
150
+ }
151
+ }
152
+ }
153
+ });
154
+
155
+ observer.observe(document.body, {
156
+ childList: true,
157
+ subtree: true,
132
158
  });
133
159
  };
134
160
 
@@ -153,7 +179,7 @@ const submitSearch = () => {
153
179
  }, {});
154
180
 
155
181
  if (searchString) {
156
- queryParams["q"] = searchString;
182
+ queryParams["q"] = encodeURIComponent(searchString);
157
183
  }
158
184
 
159
185
  const result = Object.entries(queryParams)
@@ -10,6 +10,6 @@
10
10
  };
11
11
 
12
12
  $(function () {
13
- $(".admin-autocomplete").djangoCustomSelect2();
13
+ $(".unfold-admin-autocomplete.admin-autocomplete").djangoCustomSelect2();
14
14
  });
15
15
  }
unfold/styles.css CHANGED
@@ -60,6 +60,10 @@ html {
60
60
  @apply text-red-600;
61
61
  }
62
62
 
63
+ .sortable-ghost {
64
+ @apply opacity-50;
65
+ }
66
+
63
67
  /*******************************************************
64
68
  Icons
65
69
  *******************************************************/
@@ -287,7 +291,7 @@ h3 span:nth-child(3) {
287
291
  Autocomplete
288
292
  *******************************************************/
289
293
  .select2.select2-container {
290
- @apply bg-white border max-w-2xl relative rounded-md shadow-sm !w-full dark:bg-gray-900 dark:border-gray-700;
294
+ @apply bg-white border max-w-2xl !min-h-9.5 relative rounded-md shadow-sm !w-full dark:bg-gray-900 dark:border-gray-700;
291
295
  }
292
296
 
293
297
  .errors .select2.select2-container {
@@ -10,7 +10,7 @@
10
10
  {% block breadcrumbs %}
11
11
  <div class="px-12">
12
12
  <div class="container mb-12 mx-auto -my-3">
13
- <ul class="flex">
13
+ <ul class="flex flex-wrap">
14
14
  {% url 'admin:index' as link %}
15
15
  {% trans 'Home' as name %}
16
16
  {% include 'unfold/helpers/breadcrumb_item.html' with link=link name=name %}
@@ -27,7 +27,7 @@
27
27
 
28
28
  {% if model.admin_url %}
29
29
  <a href="{{ model.admin_url }}" id="link-{{ app.app_label }}-{{ model.object_name|lower }}"
30
- class="block -mx-3 px-3 py-3 rounded-md truncate {% if model.admin_url in request.path|urlencode %}bg-gray-100 font-semibold text-primary-600 dark:bg-white/[.06] dark:text-primary-500{% endif %}">
30
+ class="block -mx-3 px-3 py-3 rounded-md truncate hover:text-primary-600 dark:hover:text-primary-500 {% if model.admin_url in request.path|urlencode %}bg-gray-100 font-semibold text-primary-600 dark:bg-white/[.06] dark:text-primary-500{% endif %}">
31
31
  {{ model.name }}
32
32
  </a>
33
33
  {% else %}
@@ -8,7 +8,7 @@
8
8
  {% block breadcrumbs %}
9
9
  <div class="px-12">
10
10
  <div class="container mb-12 mx-auto -my-3">
11
- <ul class="flex">
11
+ <ul class="flex flex-wrap">
12
12
  {% url 'admin:index' as link %}
13
13
  {% trans 'Home' as name %}
14
14
  {% include 'unfold/helpers/breadcrumb_item.html' with link=link name=name %}
@@ -18,7 +18,7 @@
18
18
  {% block breadcrumbs %}
19
19
  <div class="px-4 lg:px-12">
20
20
  <div class="container mb-12 mx-auto -my-3">
21
- <ul class="flex">
21
+ <ul class="flex flex-wrap">
22
22
  {% url 'admin:index' as link %}
23
23
  {% trans 'Home' as name %}
24
24
  {% include 'unfold/helpers/breadcrumb_item.html' with link=link name=name %}
@@ -13,7 +13,7 @@
13
13
  {% block breadcrumbs %}
14
14
  <div class="px-4 lg:px-12">
15
15
  <div class="container mb-6 mx-auto -my-3 lg:mb-12">
16
- <ul class="flex">
16
+ <ul class="flex flex-wrap">
17
17
  {% url 'admin:index' as link %}
18
18
  {% trans 'Home' as name %}
19
19
  {% include 'unfold/helpers/breadcrumb_item.html' with link=link name=name %}
@@ -26,7 +26,7 @@
26
26
  {% block breadcrumbs %}
27
27
  <div class="px-4 lg:px-12">
28
28
  <div class="{% if not cl.model_admin.list_fullwidth %}container{% endif %} mb-6 mx-auto -my-3 lg:mb-12">
29
- <ul class="flex">
29
+ <ul class="flex flex-wrap">
30
30
  {% url 'admin:index' as link %}
31
31
  {% trans 'Home' as name %}
32
32
  {% include 'unfold/helpers/breadcrumb_item.html' with link=link name=name %}
@@ -62,52 +62,62 @@
62
62
  {% endif %}
63
63
 
64
64
  <div class="flex -mx-4 module{% if cl.has_filters %} filtered{% endif %}" id="changelist">
65
- <div class="changelist-form-container flex-grow min-w-0 px-4" x-data="{ filterOpen: false }">
66
- {% block date_hierarchy %}
67
- {% if cl.date_hierarchy %}
68
- {% date_hierarchy cl %}
65
+ <div class="changelist-form-container flex flex-row flex-grow gap-4 min-w-0 px-4" x-data="{ filterOpen: false }">
66
+ <div class="flex-grow min-w-0">
67
+ {% block date_hierarchy %}
68
+ {% if cl.date_hierarchy %}
69
+ {% date_hierarchy cl %}
70
+ {% endif %}
71
+ {% endblock %}
72
+
73
+ {% if cl.model_admin.list_before_template %}
74
+ {% include cl.model_admin.list_before_template %}
69
75
  {% endif %}
70
- {% endblock %}
71
76
 
72
- <form id="changelist-form" method="post"{% if cl.formset and cl.formset.is_multipart %} enctype="multipart/form-data"{% endif %} novalidate>
73
- {% csrf_token %}
77
+ <form id="changelist-form" method="post"{% if cl.formset and cl.formset.is_multipart %} enctype="multipart/form-data"{% endif %} novalidate>
78
+ {% csrf_token %}
74
79
 
75
- {% if cl.formset %}
76
- <div>{{ cl.formset.management_form }}</div>
77
- {% endif %}
80
+ {% if cl.formset %}
81
+ <div>{{ cl.formset.management_form }}</div>
82
+ {% endif %}
83
+
84
+ {% block result_list %}
85
+ {% if actions_on_top %}
86
+ {% if cl.search_fields or action_form or cl.has_filters %}
87
+ <div class="bg-gray-50 flex flex-col gap-3 mb-4 p-3 rounded-md lg:flex-row dark:bg-gray-800">
88
+ {% block search %}
89
+ {% search_form cl %}
90
+ {% endblock %}
78
91
 
79
- {% block result_list %}
80
- {% if actions_on_top %}
81
- {% if cl.search_fields or action_form or cl.has_filters %}
82
- <div class="bg-gray-50 flex flex-col gap-3 mb-4 p-3 rounded-md lg:flex-row dark:bg-gray-800">
83
- {% block search %}
84
- {% search_form cl %}
85
- {% endblock %}
86
-
87
- {% if action_form %}
88
- {% admin_actions %}
89
- {% endif %}
90
-
91
- {% block filters %}
92
- {% if cl.has_filters %}
93
- <a class="{% if cl.has_active_filters %}bg-primary-600 border-primary-600 text-white{% else %}bg-white dark:bg-gray-900 dark:border-gray-700{% endif %} border cursor-pointer flex font-medium group items-center px-3 py-2 rounded-md shadow-sm text-sm lg:ml-auto md:mt-0" x-on:click="filterOpen = true" x-on:keydown.escape.window="filterOpen = false">
94
- {% trans "Filters" %}
95
-
96
- <span class="material-symbols-outlined md-18 ml-auto -mr-1 pl-4 {% if cl.has_active_filters %}text-white{% else %}text-gray-400 group-hover:text-gray-500 dark:group-hover:text-gray-400 dark:text-gray-500{% endif %}">filter_list</span>
97
- </a>
92
+ {% if action_form %}
93
+ {% admin_actions %}
98
94
  {% endif %}
99
- {% endblock %}
100
- </div>
95
+
96
+ {% block filters %}
97
+ {% if cl.has_filters %}
98
+ <a class="{% if cl.has_active_filters %}bg-primary-600 border-primary-600 text-white{% else %}bg-white dark:bg-gray-900 dark:border-gray-700{% endif %} border cursor-pointer flex font-medium group items-center px-3 py-2 rounded-md shadow-sm text-sm lg:ml-auto md:mt-0 {% if not cl.model_admin.list_filter_sheet %}2xl:hidden{% endif %}" x-on:click="filterOpen = true" x-on:keydown.escape.window="filterOpen = false">
99
+ {% trans "Filters" %}
100
+
101
+ <span class="material-symbols-outlined md-18 ml-auto -mr-1 pl-4 {% if cl.has_active_filters %}text-white{% else %}text-gray-400 group-hover:text-gray-500 dark:group-hover:text-gray-400 dark:text-gray-500{% endif %}">filter_list</span>
102
+ </a>
103
+ {% endif %}
104
+ {% endblock %}
105
+ </div>
106
+ {% endif %}
101
107
  {% endif %}
102
- {% endif %}
103
108
 
104
- {% unfold_result_list cl %}
109
+ {% unfold_result_list cl %}
105
110
 
106
- {% block pagination %}
107
- {% pagination cl %}
111
+ {% block pagination %}
112
+ {% pagination cl %}
113
+ {% endblock %}
108
114
  {% endblock %}
109
- {% endblock %}
110
- </form>
115
+ </form>
116
+
117
+ {% if cl.model_admin.list_after_template %}
118
+ {% include cl.model_admin.list_after_template %}
119
+ {% endif %}
120
+ </div>
111
121
 
112
122
  {% if cl.has_filters %}
113
123
  {% include "unfold/change_list_filter.html" %}
@@ -10,9 +10,9 @@
10
10
  {% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} delete-confirmation{% endblock %}
11
11
 
12
12
  {% block breadcrumbs %}
13
- <div class="px-12">
14
- <div class="container mb-12 mx-auto -my-3">
15
- <ul class="flex">
13
+ <div class="px-4 lg:px-12">
14
+ <div class="container mb-6 mx-auto -my-3 lg:mb-12">
15
+ <ul class="flex flex-wrap">
16
16
  {% url 'admin:index' as link %}
17
17
  {% trans 'Home' as name %}
18
18
  {% include 'unfold/helpers/breadcrumb_item.html' with link=link name=name %}
@@ -95,12 +95,7 @@
95
95
  <input type="hidden" name="{{ to_field_var }}" value="{{ to_field }}">
96
96
  {% endif %}
97
97
 
98
-
99
- <a href="#" class="border cancel-link font-medium hidden mb-3 px-3 py-2 rounded-md w-full hover:bg-gray-50 lg:block lg:mb-0 lg:mr-3 lg:w-auto dark:border-gray-700 dark:text-font-default-dark dark:hover:text-gray-200 dark:hover:bg-gray-900">
100
- {% translate "No, take me back" %}
101
- </a>
102
-
103
- <input type="submit" value="{% translate 'Yes, I’m sure' %}" class="bg-red-600 cursor-pointer font-medium ml-auto px-3 py-2 rounded-md text-white dark:bg-red-500/20 dark:text-red-500">
98
+ {% include "unfold/helpers/delete_submit_line.html" %}
104
99
  </div>
105
100
  </form>
106
101
  </div>
@@ -10,9 +10,9 @@
10
10
  {% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} delete-confirmation delete-selected-confirmation{% endblock %}
11
11
 
12
12
  {% block breadcrumbs %}
13
- <div class="px-12">
14
- <div class="container mb-12 mx-auto -my-3">
15
- <ul class="flex">
13
+ <div class="px-4 lg:px-12">
14
+ <div class="container mb-6 mx-auto -my-3 lg:mb-12">
15
+ <ul class="flex flex-wrap">
16
16
  {% url 'admin:index' as link %}
17
17
  {% trans 'Home' as name %}
18
18
  {% include 'unfold/helpers/breadcrumb_item.html' with link=link name=name %}
@@ -89,11 +89,7 @@
89
89
  <input type="hidden" name="action" value="delete_selected">
90
90
  <input type="hidden" name="post" value="yes">
91
91
 
92
- <a href="#" class="border cancel-link font-medium hidden mb-3 px-3 py-2 rounded-md transition-all w-full hover:bg-gray-50 lg:block lg:mb-0 lg:mr-3 lg:w-auto dark:border-gray-700 dark:text-font-default-dark dark:hover:text-gray-200 dark:hover:bg-gray-900">
93
- {% translate "No, take me back" %}
94
- </a>
95
-
96
- <input type="submit" value="{% translate 'Yes, I’m sure' %}" class="bg-red-600 cursor-pointer font-medium ml-auto px-3 py-2 rounded-md text-white dark:bg-red-500/20 dark:text-red-500">
92
+ {% include "unfold/helpers/delete_submit_line.html" %}
97
93
  </div>
98
94
  </form>
99
95
  </div>
@@ -13,82 +13,84 @@
13
13
  {{ inline_admin_formset.formset.management_form }}
14
14
  {% include "unfold/helpers/messages/error.html" with errors=inline_admin_formset.formset.non_form_errors %}
15
15
 
16
- {% if inline_admin_formset.forms|length == 0 %}
17
- <div>
18
- <p class="mb-6 text-sm">
19
- {% trans "No records found." %}
20
- </p>
21
- </div>
22
- {% else %}
23
- <div class="border border-gray-200 mb-6 overflow-hidden rounded-md shadow-sm w-full dark:border-gray-800">
24
- {% for inline_admin_form in inline_admin_formset %}
25
- <div class="inline-related group inline-stacked {% if inline_admin_form.original or inline_admin_form.show_url %} has_original{% endif %}{% if forloop.last and inline_admin_formset.has_add_permission %} empty-form last-related{% endif %}" id="{{ inline_admin_formset.formset.prefix }}-{% if not forloop.last %}{{ forloop.counter0 }}{% else %}empty{% endif %}">
26
- {% if not inline_admin_formset.opts.hide_title or inline_admin_formset.formset.can_delete and inline_admin_formset.has_delete_permission %}
27
- <h3 class="bg-gray-50 border-b {% if not forloop.first %}border-t{% endif %} border-gray-200 flex font-medium items-center mb-3 px-3 py-2 text-sm dark:bg-white/[.02] dark:border-gray-800">
28
- <span class="mr-2">
29
- {{ inline_admin_formset.opts.verbose_name|capfirst }}:
30
- </span>
16
+ <div class="border border-gray-200 mb-6 overflow-hidden rounded-md shadow-sm w-full dark:border-gray-800 *:border-t first:*:border-t-0 *:border-gray-200 dark:*:border-gray-800"
17
+ {% if inline_admin_formset.opts.ordering_field %}
18
+ data-ordering-field="{{ inline_admin_formset.opts.ordering_field }}" x-on:end="sortRecords" x-sort.ghost
19
+ {% endif %}>
31
20
 
32
- <span class="inline_label font-semibold text-font-important-light dark:text-font-important-dark">
33
- {% if inline_admin_form.original and inline_admin_form.model_admin.show_change_link and inline_admin_form.model_admin.has_registered_model %}
34
- <a href="{% url inline_admin_form.model_admin.opts|admin_urlname:'change' inline_admin_form.original.pk|admin_urlquote %}" class="{% if inline_admin_formset.has_change_permission %}inlinechangelink{% else %}inlineviewlink{% endif %} font-medium text-primary-600 dark:text-primary-500">
35
- {{ inline_admin_form.original }}
36
- </a>
37
- {% else %}
38
- {% if inline_admin_form.original %}
39
- {% with inline_title=inline_admin_form.original.get_inline_title %}
40
- {% if inline_title %}
41
- {{ inline_title }}
42
- {% else %}
43
- {{ inline_admin_form.original }}
44
- {% endif %}
45
- {% endwith %}
21
+ {% for inline_admin_form in inline_admin_formset %}
22
+ <div x-sort:item class="inline-related group inline-stacked {% if inline_admin_form.original or inline_admin_form.show_url %} has_original{% endif %}{% if forloop.last and inline_admin_formset.has_add_permission %} empty-form last-related{% endif %}" id="{{ inline_admin_formset.formset.prefix }}-{% if not forloop.last %}{{ forloop.counter0 }}{% else %}empty{% endif %}">
23
+ {% if not inline_admin_formset.opts.hide_title or inline_admin_formset.formset.can_delete and inline_admin_formset.has_delete_permission %}
24
+ <h3 class="bg-gray-50 border-b border-gray-200 flex font-medium items-center gap-2 mb-3 px-3 py-2 text-sm dark:bg-white/[.02] dark:border-gray-800">
25
+ {% if inline_admin_formset.opts.ordering_field %}
26
+ {% if inline_admin_form.original %}
27
+ <span class="material-symbols-outlined cursor-pointer" x-sort:handle>drag_indicator</span>
28
+ {% else %}
29
+ <span class="-mr-2" x-sort:handle></span>
30
+ {% endif %}
31
+ {% endif %}
46
32
 
47
- {% if inline_admin_form.model_admin.show_change_link and inline_admin_form.model_admin.has_registered_model %}
48
- <a href="{% url inline_admin_form.model_admin.opts|admin_urlname:'change' inline_admin_form.original.pk|admin_urlquote %}" class="{{ inline_admin_formset.has_change_permission|yesno:'inlinechangelink,inlineviewlink' }} font-medium ml-2 text-primary-600 dark:text-primary-500">
49
- {% if inline_admin_formset.has_change_permission %}
50
- {% translate "Change" %}
51
- {% else %}
52
- {% translate "View" %}
53
- {% endif %}
54
- </a>
33
+ {{ inline_admin_formset.opts.verbose_name|capfirst }}:
34
+
35
+ <span class="inline_label font-semibold text-font-important-light dark:text-font-important-dark">
36
+ {% if inline_admin_form.original and inline_admin_form.model_admin.show_change_link and inline_admin_form.model_admin.has_registered_model %}
37
+ <a href="{% url inline_admin_form.model_admin.opts|admin_urlname:'change' inline_admin_form.original.pk|admin_urlquote %}" class="{% if inline_admin_formset.has_change_permission %}inlinechangelink{% else %}inlineviewlink{% endif %} font-medium text-primary-600 dark:text-primary-500">
38
+ {{ inline_admin_form.original }}
39
+ </a>
40
+ {% else %}
41
+ {% if inline_admin_form.original %}
42
+ {% with inline_title=inline_admin_form.original.get_inline_title %}
43
+ {% if inline_title %}
44
+ {{ inline_title }}
45
+ {% else %}
46
+ {{ inline_admin_form.original }}
55
47
  {% endif %}
56
- {% else %}
57
- #{{ forloop.counter }}
48
+ {% endwith %}
49
+
50
+ {% if inline_admin_form.model_admin.show_change_link and inline_admin_form.model_admin.has_registered_model %}
51
+ <a href="{% url inline_admin_form.model_admin.opts|admin_urlname:'change' inline_admin_form.original.pk|admin_urlquote %}" class="{{ inline_admin_formset.has_change_permission|yesno:'inlinechangelink,inlineviewlink' }} font-medium ml-2 text-primary-600 dark:text-primary-500">
52
+ {% if inline_admin_formset.has_change_permission %}
53
+ {% translate "Change" %}
54
+ {% else %}
55
+ {% translate "View" %}
56
+ {% endif %}
57
+ </a>
58
58
  {% endif %}
59
+ {% else %}
60
+ #{{ forloop.counter }}
59
61
  {% endif %}
60
- </span>
61
-
62
- {% if inline_admin_form.show_url %}
63
- <a href="{{ inline_admin_form.absolute_url }}" class="font-medium ml-2 text-primary-600 dark:text-primary-500">
64
- {% trans "View on site" %}
65
- </a>
66
62
  {% endif %}
63
+ </span>
67
64
 
68
- {% if inline_admin_formset.formset.can_delete and inline_admin_formset.has_delete_permission and inline_admin_form.original %}
69
- <span class="delete flex gap-2 items-center ml-auto">
70
- {{ inline_admin_form.deletion_field.field|add_css_class:form_classes.checkbox }} {{ inline_admin_form.deletion_field.label_tag }}
71
- </span>
72
- {% endif %}
73
- </h3>
74
- {% endif %}
65
+ {% if inline_admin_form.show_url %}
66
+ <a href="{{ inline_admin_form.absolute_url }}" class="font-medium ml-2 text-primary-600 dark:text-primary-500">
67
+ {% trans "View on site" %}
68
+ </a>
69
+ {% endif %}
70
+
71
+ {% if inline_admin_formset.formset.can_delete and inline_admin_formset.has_delete_permission and inline_admin_form.original %}
72
+ <span class="delete flex gap-2 items-center ml-auto">
73
+ {{ inline_admin_form.deletion_field.field|add_css_class:form_classes.checkbox }} {{ inline_admin_form.deletion_field.label_tag }}
74
+ </span>
75
+ {% endif %}
76
+ </h3>
77
+ {% endif %}
75
78
 
76
- {% include "unfold/helpers/messages/error.html" with errors=inline_admin_form.form.non_field_errors %}
79
+ {% include "unfold/helpers/messages/error.html" with errors=inline_admin_form.form.non_field_errors %}
77
80
 
78
- {% for fieldset in inline_admin_form %}
79
- <div class="px-3 -mb-5 {% if inline_admin_formset.opts.hide_title %}{% if not inline_admin_formset.formset.can_delete or not inline_admin_formset.has_delete_permission %}pt-3{% endif %}{% endif %}">
80
- {% include 'admin/includes/fieldset.html' with stacked=1 %}
81
- </div>
82
- {% endfor %}
81
+ {% for fieldset in inline_admin_form %}
82
+ <div class="px-3 -mb-5 {% if inline_admin_formset.opts.hide_title %}{% if not inline_admin_formset.formset.can_delete or not inline_admin_formset.has_delete_permission %}pt-3{% endif %}{% endif %}">
83
+ {% include 'admin/includes/fieldset.html' with stacked=1 %}
84
+ </div>
85
+ {% endfor %}
83
86
 
84
- {% if inline_admin_form.needs_explicit_pk_field %}
85
- {{ inline_admin_form.pk_field.field }}
86
- {% endif %}
87
+ {% if inline_admin_form.needs_explicit_pk_field %}
88
+ {{ inline_admin_form.pk_field.field }}
89
+ {% endif %}
87
90
 
88
- {% if inline_admin_form.fk_field %}{{ inline_admin_form.fk_field.field }}{% endif %}
89
- </div>
90
- {% endfor %}
91
- </div>
92
- {% endif %}
91
+ {% if inline_admin_form.fk_field %}{{ inline_admin_form.fk_field.field }}{% endif %}
92
+ </div>
93
+ {% endfor %}
94
+ </div>
93
95
  </fieldset>
94
96
  </div>