django-unfold 0.23.0__py3-none-any.whl → 0.25.0__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (26) hide show
  1. {django_unfold-0.23.0.dist-info → django_unfold-0.25.0.dist-info}/METADATA +97 -4
  2. {django_unfold-0.23.0.dist-info → django_unfold-0.25.0.dist-info}/RECORD +26 -24
  3. unfold/admin.py +3 -3
  4. unfold/contrib/filters/admin.py +116 -0
  5. unfold/contrib/filters/forms.py +29 -1
  6. unfold/contrib/filters/templates/unfold/filters/filters_date_range.html +1 -1
  7. unfold/contrib/filters/templates/unfold/filters/filters_datetime_range.html +1 -1
  8. unfold/contrib/filters/templates/unfold/filters/filters_field.html +7 -0
  9. unfold/contrib/filters/templates/unfold/filters/filters_numeric_range.html +1 -1
  10. unfold/contrib/filters/templates/unfold/filters/filters_numeric_single.html +1 -1
  11. unfold/contrib/filters/templates/unfold/filters/filters_numeric_slider.html +1 -1
  12. unfold/contrib/import_export/admin.py +1 -1
  13. unfold/contrib/import_export/forms.py +8 -3
  14. unfold/contrib/import_export/templates/admin/import_export/export.html +1 -1
  15. unfold/contrib/import_export/templates/admin/import_export/import_form.html +9 -16
  16. unfold/contrib/import_export/templates/admin/import_export/resource_fields_list.html +24 -0
  17. unfold/static/unfold/css/styles.css +1 -1
  18. unfold/styles.css +1 -1
  19. unfold/templates/admin/change_list_results.html +67 -65
  20. unfold/templates/admin/edit_inline/stacked.html +2 -2
  21. unfold/templates/admin/edit_inline/tabular.html +111 -109
  22. unfold/templates/admin/filter.html +2 -2
  23. unfold/templates/unfold/helpers/display_header.html +16 -13
  24. unfold/widgets.py +2 -2
  25. {django_unfold-0.23.0.dist-info → django_unfold-0.25.0.dist-info}/LICENSE.md +0 -0
  26. {django_unfold-0.23.0.dist-info → django_unfold-0.25.0.dist-info}/WHEEL +0 -0
@@ -23,7 +23,7 @@
23
23
 
24
24
  <span class="inline_label font-semibold text-gray-900">
25
25
  {% if inline_admin_form.original and inline_admin_form.model_admin.show_change_link and inline_admin_form.model_admin.has_registered_model %}
26
- <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 %} ml-1">
26
+ <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 ml-1 text-primary-600 underline text-xs">
27
27
  {{ inline_admin_form.original }}
28
28
  </a>
29
29
  {% else %}
@@ -37,7 +37,7 @@
37
37
 
38
38
  {% if inline_admin_form.show_url %}
39
39
  <a href="{{ inline_admin_form.absolute_url }}" class="h-4 leading-none ml-1">
40
- <span class="material-symbols-outlined h-4 md-16 text-gray-400">launch</span>
40
+ <span class="material-symbols-outlined h-4 md-16 text-primary-600">launch</span>
41
41
  </a>
42
42
  {% endif %}
43
43
 
@@ -4,7 +4,7 @@
4
4
  <div class="tabular inline-related {% if forloop.last %}last-related{% endif %}">
5
5
  {{ inline_admin_formset.formset.management_form }}
6
6
 
7
- <fieldset class="module {{ inline_admin_formset.classes }}">
7
+ <fieldset class="module {{ inline_admin_formset.classes }} min-w-0">
8
8
  <h2 class="bg-gray-100 border border-transparent font-semibold mb-6 px-4 py-3 rounded-md text-gray-900 text-sm lg:-mx-4 dark:bg-white/[.02] dark:border dark:border-gray-800 dark:text-gray-200">
9
9
  {% if inline_admin_formset.formset.max_num == 1 %}
10
10
  {{ inline_admin_formset.opts.verbose_name|capfirst }}
@@ -21,133 +21,135 @@
21
21
  {% trans "No records found." %}
22
22
  </p>
23
23
  {% else %}
24
- <table class="border border-gray-200 border-spacing-none border-separate mb-6 rounded-md shadow-sm text-gray-700 w-full dark:border-gray-800">
25
- <thead class="hidden lg:table-header-group">
26
- <tr>
27
- {% for field in inline_admin_formset.fields %}
28
- {% if not field.widget.is_hidden %}
29
- <th class="column-{{ field.name }}{% if field.required %} required{% endif %} align-middle border-b border-gray-200 font-medium px-3 py-2 text-left text-gray-400 text-sm dark:border-gray-800">
30
- <span class="flex flex-row items-center">
31
- {{ field.label|capfirst }}
24
+ <div class="border border-gray-200 mb-6 overflow-x-auto rounded-md shadow-sm dark:border-gray-800">
25
+ <table class="border-spacing-none border-separate text-gray-700 w-full">
26
+ <thead class="hidden lg:table-header-group">
27
+ <tr>
28
+ {% for field in inline_admin_formset.fields %}
29
+ {% if not field.widget.is_hidden %}
30
+ <th class="column-{{ field.name }}{% if field.required %} required{% endif %} align-middle border-b border-gray-200 font-medium px-3 py-2 text-left text-gray-400 text-sm dark:border-gray-800">
31
+ <span class="flex flex-row items-center">
32
+ {{ field.label|capfirst }}
32
33
 
33
- {% if field.help_text %}
34
- <span class="cursor-pointer material-symbols-outlined ml-2" title="{{ field.help_text|striptags }}">help</span>
35
- {% endif %}
36
- </span>
34
+ {% if field.help_text %}
35
+ <span class="cursor-pointer material-symbols-outlined ml-2" title="{{ field.help_text|striptags }}">help</span>
36
+ {% endif %}
37
+ </span>
38
+ </th>
39
+ {% endif %}
40
+ {% endfor %}
41
+
42
+ {% if inline_admin_formset.formset.can_delete and inline_admin_formset.has_delete_permission %}
43
+ <th class="align-middle border-b border-gray-200 font-medium px-3 py-2 text-left text-gray-400 text-sm lg:w-px dark:border-gray-800">
44
+ {% translate "Delete?" %}
37
45
  </th>
38
46
  {% endif %}
39
- {% endfor %}
47
+ </tr>
48
+ </thead>
40
49
 
41
- {% if inline_admin_formset.formset.can_delete and inline_admin_formset.has_delete_permission %}
42
- <th class="align-middle border-b border-gray-200 font-medium px-3 py-2 text-left text-gray-400 text-sm lg:w-px dark:border-gray-800">
43
- {% translate "Delete?" %}
44
- </th>
45
- {% endif %}
46
- </tr>
47
- </thead>
50
+ <tbody>
51
+ {% for inline_admin_form in inline_admin_formset %}
52
+ {% if inline_admin_form.form.non_field_errors %}
53
+ <tr class="row-form-errors group inline-tabular">
54
+ <td colspan="{{ inline_admin_form|cell_count }}">
55
+ {% include "unfold/helpers/messages/error.html" with errors=inline_admin_form.form.non_field_errors %}
56
+ </td>
57
+ </tr>
58
+ {% endif %}
48
59
 
49
- <tbody>
50
- {% for inline_admin_form in inline_admin_formset %}
51
- {% if inline_admin_form.form.non_field_errors %}
52
- <tr class="row-form-errors group inline-tabular">
53
- <td colspan="{{ inline_admin_form|cell_count }}">
54
- {% include "unfold/helpers/messages/error.html" with errors=inline_admin_form.form.non_field_errors %}
55
- </td>
56
- </tr>
57
- {% endif %}
60
+ {% if inline_admin_form.original or inline_admin_form.show_url %}
61
+ <tr>
62
+ <td class="original" colspan="10">
63
+ {% if inline_admin_form.original or inline_admin_form.show_url %}
64
+ <p class="align-middle flex font-normal items-center leading-none px-3 text-gray-500 text-left text-sm whitespace-nowrap">
65
+ {% if inline_admin_form.original %}
66
+ {% if inline_admin_form.model_admin.show_change_link and inline_admin_form.model_admin.has_registered_model %}
67
+ <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 mt-3 text-primary-600 underline text-xs">
68
+ {{ inline_admin_form.original }}
69
+ </a>
70
+ {% endif %}
71
+ {% else %}
72
+ {{ inline_admin_form.original }}
73
+ {% endif %}
58
74
 
59
- {% if inline_admin_form.original or inline_admin_form.show_url %}
60
- <tr>
61
- <td class="original" colspan="10">
62
- {% if inline_admin_form.original or inline_admin_form.show_url %}
63
- <p class="align-middle flex font-normal items-center leading-none px-3 text-gray-500 text-left text-sm whitespace-nowrap">
64
- {% if inline_admin_form.original %}
65
- {% if inline_admin_form.model_admin.show_change_link and inline_admin_form.model_admin.has_registered_model %}
66
- <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 %} mt-3 text-gray-500 text-xs">
67
- {{ inline_admin_form.original }}
75
+ {% if inline_admin_form.show_url %}
76
+ <a href="{{ inline_admin_form.absolute_url }}" class="ml-1 mt-3">
77
+ <span class="material-symbols-outlined h-4 md-16 text-primary-600">launch</span>
68
78
  </a>
69
79
  {% endif %}
70
- {% else %}
71
- {{ inline_admin_form.original }}
72
- {% endif %}
73
-
74
- {% if inline_admin_form.show_url %}
75
- <a href="{{ inline_admin_form.absolute_url }}" class="ml-1 mt-3">
76
- <span class="material-symbols-outlined h-4 md-16 text-gray-400">launch</span>
77
- </a>
78
- {% endif %}
79
- </p>
80
- {% endif %}
80
+ </p>
81
+ {% endif %}
81
82
 
82
- {% if inline_admin_form.needs_explicit_pk_field %}
83
- {{ inline_admin_form.pk_field.field }}
84
- {% endif %}
83
+ {% if inline_admin_form.needs_explicit_pk_field %}
84
+ {{ inline_admin_form.pk_field.field }}
85
+ {% endif %}
85
86
 
86
- {% if inline_admin_form.fk_field %}
87
- {{ inline_admin_form.fk_field.field }}
88
- {% endif %}
89
- </td>
90
- </tr>
91
- {% endif %}
87
+ {% if inline_admin_form.fk_field %}
88
+ {{ inline_admin_form.fk_field.field }}
89
+ {% endif %}
90
+ </td>
91
+ </tr>
92
+ {% endif %}
92
93
 
93
- <tr class="lg:border-b-0 form-row {% 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{% endif %}" id="{{ inline_admin_formset.formset.prefix }}-{% if not forloop.last %}{{ forloop.counter0 }}{% else %}empty{% endif %}">
94
- {% spaceless %}
95
- {% for fieldset in inline_admin_form %}
96
- {% for line in fieldset %}
97
- {% for field in line %}
98
- {% if not field.is_readonly and field.field.is_hidden %}
99
- {{ field.field }}
100
- {% endif %}
94
+ <tr class="lg:border-b-0 form-row {% 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{% endif %}" id="{{ inline_admin_formset.formset.prefix }}-{% if not forloop.last %}{{ forloop.counter0 }}{% else %}empty{% endif %}">
95
+ {% spaceless %}
96
+ {% for fieldset in inline_admin_form %}
97
+ {% for line in fieldset %}
98
+ {% for field in line %}
99
+ {% if not field.is_readonly and field.field.is_hidden %}
100
+ {{ field.field }}
101
+ {% endif %}
102
+ {% endfor %}
101
103
  {% endfor %}
102
104
  {% endfor %}
103
- {% endfor %}
104
- {% endspaceless %}
105
+ {% endspaceless %}
105
106
 
106
- {% with is_last_row=forloop.last %}
107
- {% for fieldset in inline_admin_form %}
108
- {% for line in fieldset %}
109
- {% with is_last_col=forloop.last %}
110
- {% for field in line %}
111
- {% if field.is_readonly or not field.field.is_hidden %}
112
- <td{% if field.field.name %} class="field-{{ field.field.name }}{% if field.field.errors|length > 0 %} errors{% endif %}{% if inline_admin_form.original %} p-3 lg:py-3{% else %} py-3{% endif %}{% if field.is_checkbox %} align-middle{% else %} align-top{% endif %} {% if is_last_row and not inline_admin_formset.has_add_permission %}{% if is_last_col %}border-0 {% else %}border-b lg:border-0{% endif %}{% else %}border-b{% endif %} border-gray-200 flex items-center before:capitalize before:content-[attr(data-label)] before:mr-auto before:text-gray-500 before:w-72 lg:before:hidden font-normal px-3 text-left text-sm lg:table-cell dark:border-gray-800 {% if field.field.is_hidden %} !hidden{% endif %}"{% endif %} data-label="{{ field.field.label }}">
113
- {% if field.is_readonly %}
114
- <div class="bg-gray-50 border font-medium max-w-lg px-3 py-2 rounded-md shadow-sm text-gray-500 text-sm truncate whitespace-nowrap dark:border-gray-700 dark:text-gray-400 dark:bg-gray-800">
115
- {{ field.contents }}
116
- </div>
117
- {% else %}
118
- {{ field.field }}
119
-
120
- {% if field.field.errors|length > 0 %}
121
- <div class="mt-1 text-red-600 text-sm dark:text-red-500">
122
- {% for error in field.field.errors %}
123
- {{ error }}
124
- {% endfor %}
107
+ {% with is_last_row=forloop.last %}
108
+ {% for fieldset in inline_admin_form %}
109
+ {% for line in fieldset %}
110
+ {% with is_last_col=forloop.last %}
111
+ {% for field in line %}
112
+ {% if field.is_readonly or not field.field.is_hidden %}
113
+ <td{% if field.field.name %} class="field-{{ field.field.name }}{% if field.field.errors|length > 0 %} errors{% endif %}{% if inline_admin_form.original %} p-3 lg:py-3{% else %} py-3{% endif %}{% if field.is_checkbox %} align-middle{% else %} align-top{% endif %} {% if is_last_row and not inline_admin_formset.has_add_permission %}{% if is_last_col %}border-0 {% else %}border-b lg:border-0{% endif %}{% else %}border-b{% endif %} border-gray-200 flex items-center before:capitalize before:content-[attr(data-label)] before:mr-auto before:text-gray-500 before:w-72 lg:before:hidden font-normal px-3 text-left text-sm lg:table-cell dark:border-gray-800 {% if field.field.is_hidden %} !hidden{% endif %}"{% endif %} data-label="{{ field.field.label }}">
114
+ {% if field.is_readonly %}
115
+ <div class="bg-gray-50 border font-medium max-w-lg px-3 py-2 rounded-md shadow-sm text-gray-500 text-sm truncate whitespace-nowrap dark:border-gray-700 dark:text-gray-400 dark:bg-gray-800">
116
+ {{ field.contents }}
125
117
  </div>
118
+ {% else %}
119
+ {{ field.field }}
120
+
121
+ {% if field.field.errors|length > 0 %}
122
+ <div class="mt-1 text-red-600 text-sm dark:text-red-500">
123
+ {% for error in field.field.errors %}
124
+ {{ error }}
125
+ {% endfor %}
126
+ </div>
127
+ {% endif %}
126
128
  {% endif %}
127
- {% endif %}
128
- </td>
129
- {% endif %}
130
- {% endfor %}
131
- {% endwith %}
129
+ </td>
130
+ {% endif %}
131
+ {% endfor %}
132
+ {% endwith %}
133
+ {% endfor %}
132
134
  {% endfor %}
133
- {% endfor %}
134
135
 
135
- {% if inline_admin_formset.formset.can_delete and inline_admin_formset.has_delete_permission %}
136
- <td class="delete {% if inline_admin_form.original %}p-3 lg:py-3{% else %}py-3{% endif %} text-left font-normal px-3 text-sm text-red-600 border-b border-gray-200 flex items-center before:capitalize before:content-[attr(data-label)] before:mr-auto before:text-gray-500 before:w-72 lg:before:hidden font-normal px-3 text-sm lg:align-top lg:table-cell lg:underline lg:w-px dark:border-gray-800" data-label="{% trans "Remove" %}">
137
- {% if inline_admin_form.original %}
138
- <div class="flex flex-row lg:mt-3">
139
- <div class="ml-auto">
140
- {{ inline_admin_form.deletion_field.field|add_css_class:form_classes.checkbox }}
136
+ {% if inline_admin_formset.formset.can_delete and inline_admin_formset.has_delete_permission %}
137
+ <td class="delete {% if inline_admin_form.original %}p-3 lg:py-3{% else %}py-3{% endif %} text-left font-normal px-3 text-sm text-red-600 border-b border-gray-200 flex items-center before:capitalize before:content-[attr(data-label)] before:mr-auto before:text-gray-500 before:w-72 lg:before:hidden font-normal px-3 text-sm lg:align-top lg:table-cell lg:underline lg:w-px dark:border-gray-800" data-label="{% trans "Remove" %}">
138
+ {% if inline_admin_form.original %}
139
+ <div class="flex flex-row lg:mt-3">
140
+ <div class="ml-auto">
141
+ {{ inline_admin_form.deletion_field.field|add_css_class:form_classes.checkbox }}
142
+ </div>
141
143
  </div>
142
- </div>
143
- {% endif %}
144
- </td>
145
- {% endif %}
146
- {% endwith %}
147
- </tr>
148
- {% endfor %}
149
- </tbody>
150
- </table>
144
+ {% endif %}
145
+ </td>
146
+ {% endif %}
147
+ {% endwith %}
148
+ </tr>
149
+ {% endfor %}
150
+ </tbody>
151
+ </table>
152
+ </div>
151
153
  {% endif %}
152
154
  </div>
153
155
  </fieldset>
@@ -1,12 +1,12 @@
1
1
  {% load i18n unfold %}
2
2
 
3
3
  <div class="mb-6">
4
- <h3 class="font-medium mb-4 text-gray-700 text-sm dark:text-gray-200">
4
+ <h3 class="font-medium mb-2 text-gray-700 text-sm dark:text-gray-200">
5
5
  {% blocktranslate with filter_title=title %} By {{ filter_title }} {% endblocktranslate %}
6
6
  </h3>
7
7
 
8
8
  {% for choice in choices %}
9
- {% if choice.selected %}
9
+ {% if choice.selected and spec.lookup_val.0 %}
10
10
  <input type="hidden" name="{{ spec.lookup_kwarg }}" value="{{ spec.lookup_val.0 }}" />
11
11
  {% endif %}
12
12
  {% endfor %}
@@ -1,17 +1,20 @@
1
1
  <div class="flex gap-4 items-center">
2
- {% if value.2 %}
3
- <div class="border flex font-medium h-8 justify-center items-center rounded-full text-xs uppercase w-8 dark:border-gray-700">
4
- {{ value.2 }}
5
- </div>
6
- {% endif %}
2
+ {% if value.3 and value.3.path %}
3
+ <div class="bg-center bg-cover bg-white border flex font-medium h-8 w-8 dark:bg-gray-900 dark:border-gray-700 {% if value.3.squared %}rounded-sm{% else %}rounded-full{% endif %}" style="background-image: url('{{ value.3.path }}')">
4
+ </div>
5
+ {% elif value.2 %}
6
+ <div class="bg-white border flex font-medium h-8 justify-center items-center rounded-full text-xs uppercase w-8 dark:bg-gray-900 dark:border-gray-700">
7
+ {{ value.2 }}
8
+ </div>
9
+ {% endif %}
7
10
 
8
- <div class="flex flex-col text-right lg:text-left">
9
- <h3>{{ value.0 }}</h3>
11
+ <div class="flex flex-col text-right lg:text-left">
12
+ <h3>{{ value.0 }}</h3>
10
13
 
11
- {% if value.1 %}
12
- <p class="text-gray-500">
13
- {{ value.1 }}
14
- </p>
15
- {% endif %}
16
- </div>
14
+ {% if value.1 %}
15
+ <p class="text-gray-500">
16
+ {{ value.1 }}
17
+ </p>
18
+ {% endif %}
19
+ </div>
17
20
  </div>
unfold/widgets.py CHANGED
@@ -444,7 +444,7 @@ class UnfoldAdminNullBooleanSelectWidget(NullBooleanSelect):
444
444
  super().__init__(attrs)
445
445
 
446
446
 
447
- class UnfoldAdminSelect(Select):
447
+ class UnfoldAdminSelectWidget(Select):
448
448
  def __init__(self, attrs=None, choices=()):
449
449
  if attrs is None:
450
450
  attrs = {}
@@ -482,7 +482,7 @@ try:
482
482
  def __init__(self, *args, **kwargs):
483
483
  super().__init__(
484
484
  amount_widget=UnfoldAdminTextInputWidget,
485
- currency_widget=UnfoldAdminSelect(choices=CURRENCY_CHOICES),
485
+ currency_widget=UnfoldAdminSelectWidget(choices=CURRENCY_CHOICES),
486
486
  )
487
487
 
488
488
  except ImportError: