django-unfold 0.53.0__py3-none-any.whl → 0.55.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.
- {django_unfold-0.53.0.dist-info → django_unfold-0.55.0.dist-info}/METADATA +24 -11
- {django_unfold-0.53.0.dist-info → django_unfold-0.55.0.dist-info}/RECORD +56 -33
- {django_unfold-0.53.0.dist-info → django_unfold-0.55.0.dist-info}/WHEEL +1 -1
- unfold/contrib/filters/admin/__init__.py +17 -0
- unfold/contrib/filters/admin/choice_filters.py +173 -0
- unfold/contrib/filters/admin/dropdown_filters.py +15 -1
- unfold/contrib/filters/admin/mixins.py +25 -0
- unfold/contrib/filters/forms.py +41 -3
- unfold/contrib/filters/templates/unfold/filters/filters_date_range.html +1 -1
- unfold/contrib/filters/templates/unfold/filters/filters_datetime_range.html +1 -1
- unfold/layout.py +23 -0
- unfold/sites.py +17 -6
- unfold/static/admin/js/inlines.js +23 -3
- unfold/static/unfold/css/styles.css +1 -1
- unfold/static/unfold/fonts/material-symbols/LICENSE +202 -0
- unfold/static/unfold/fonts/material-symbols/Material-Symbols-Outlined.woff2 +0 -0
- unfold/static/unfold/js/alpine.js +2 -2
- unfold/static/unfold/js/select2.init.js +4 -0
- unfold/styles.css +2 -1
- unfold/templates/admin/change_list.html +15 -13
- unfold/templates/admin/change_list_results.html +1 -1
- unfold/templates/admin/edit_inline/tabular.html +1 -2
- unfold/templates/unfold/components/button.html +1 -1
- unfold/templates/unfold/components/chart/cohort.html +2 -2
- unfold/templates/unfold/helpers/change_list_filter.html +2 -2
- unfold/templates/unfold/helpers/change_list_filter_actions.html +28 -26
- unfold/templates/unfold/helpers/edit_inline/tabular_field.html +10 -8
- unfold/templates/unfold/helpers/field.html +4 -2
- unfold/templates/unfold/helpers/form_label.html +1 -1
- unfold/templates/unfold/helpers/tab_action.html +17 -2
- unfold/templates/unfold/widgets/clearable_file_input.html +1 -1
- unfold/templates/unfold/widgets/clearable_file_input_small.html +1 -1
- unfold/templates/unfold/widgets/radio_option.html +1 -1
- unfold/templates/unfold_crispy/display_form.html +9 -0
- unfold/templates/unfold_crispy/errors.html +3 -0
- unfold/templates/unfold_crispy/field.html +23 -0
- unfold/templates/unfold_crispy/inputs.html +7 -0
- unfold/templates/unfold_crispy/layout/attrs.html +1 -0
- unfold/templates/unfold_crispy/layout/baseinput.html +9 -0
- unfold/templates/unfold_crispy/layout/button.html +1 -0
- unfold/templates/unfold_crispy/layout/buttonholder.html +3 -0
- unfold/templates/unfold_crispy/layout/checkbox.html +19 -0
- unfold/templates/unfold_crispy/layout/column.html +3 -0
- unfold/templates/unfold_crispy/layout/div.html +4 -0
- unfold/templates/unfold_crispy/layout/field_errors.html +7 -0
- unfold/templates/unfold_crispy/layout/fieldset.html +9 -0
- unfold/templates/unfold_crispy/layout/help_text.html +5 -0
- unfold/templates/unfold_crispy/layout/help_text_and_errors.html +3 -0
- unfold/templates/unfold_crispy/layout/radio_checkbox_select.html +21 -0
- unfold/templates/unfold_crispy/layout/row.html +3 -0
- unfold/templates/unfold_crispy/layout/table_inline_formset.html +100 -0
- unfold/templates/unfold_crispy/uni_form.html +11 -0
- unfold/templates/unfold_crispy/whole_uni_form.html +14 -0
- unfold/templatetags/unfold.py +26 -14
- unfold/widgets.py +88 -1
- {django_unfold-0.53.0.dist-info → django_unfold-0.55.0.dist-info}/LICENSE.md +0 -0
@@ -4,7 +4,7 @@
|
|
4
4
|
<div class="flex flex-col">
|
5
5
|
<h3 class="font-semibold mb-2 text-font-important-light dark:text-font-important-dark">{% blocktrans with filter_title=title %}By {{ filter_title }}{% endblocktrans %}</h3>
|
6
6
|
|
7
|
-
<div class="flex flex-col space-y-
|
7
|
+
<div class="flex flex-col space-y-2">
|
8
8
|
{% for field in choice.form %}
|
9
9
|
<div class="flex flex-row flex-wrap group relative{% if field.errors %} errors{% endif %}">
|
10
10
|
{{ field }}
|
unfold/layout.py
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
from crispy_forms.layout import BaseInput
|
2
|
+
|
3
|
+
from unfold.widgets import BUTTON_CLASSES
|
4
|
+
|
5
|
+
|
6
|
+
class ButtonClassesMixin:
|
7
|
+
def __init__(self, *args, css_class=None, **kwargs):
|
8
|
+
classes = BUTTON_CLASSES
|
9
|
+
|
10
|
+
if css_class:
|
11
|
+
classes.append(css_class)
|
12
|
+
|
13
|
+
self.field_classes = " ".join(classes)
|
14
|
+
|
15
|
+
super().__init__(*args, **kwargs)
|
16
|
+
|
17
|
+
|
18
|
+
class Submit(ButtonClassesMixin, BaseInput):
|
19
|
+
input_type = "submit"
|
20
|
+
|
21
|
+
|
22
|
+
class Button(ButtonClassesMixin, BaseInput):
|
23
|
+
input_type = "button"
|
unfold/sites.py
CHANGED
@@ -24,9 +24,16 @@ except ImportError:
|
|
24
24
|
return func
|
25
25
|
|
26
26
|
|
27
|
-
from .settings import get_config
|
28
|
-
from .utils import hex_to_rgb
|
29
|
-
from .widgets import
|
27
|
+
from unfold.settings import get_config
|
28
|
+
from unfold.utils import hex_to_rgb
|
29
|
+
from unfold.widgets import (
|
30
|
+
BUTTON_CLASSES,
|
31
|
+
CHECKBOX_CLASSES,
|
32
|
+
FILE_CLASSES,
|
33
|
+
INPUT_CLASSES,
|
34
|
+
RADIO_CLASSES,
|
35
|
+
SWITCH_CLASSES,
|
36
|
+
)
|
30
37
|
|
31
38
|
|
32
39
|
class UnfoldAdminSite(AdminSite):
|
@@ -34,7 +41,7 @@ class UnfoldAdminSite(AdminSite):
|
|
34
41
|
settings_name = "UNFOLD"
|
35
42
|
|
36
43
|
def __init__(self, name: str = "admin") -> None:
|
37
|
-
from .forms import AuthenticationForm
|
44
|
+
from unfold.forms import AuthenticationForm
|
38
45
|
|
39
46
|
super().__init__(name)
|
40
47
|
|
@@ -68,8 +75,12 @@ class UnfoldAdminSite(AdminSite):
|
|
68
75
|
sidebar_config = self._get_config("SIDEBAR", request)
|
69
76
|
data = {
|
70
77
|
"form_classes": {
|
71
|
-
"text_input": INPUT_CLASSES,
|
72
|
-
"checkbox": CHECKBOX_CLASSES,
|
78
|
+
"text_input": " ".join(INPUT_CLASSES),
|
79
|
+
"checkbox": " ".join(CHECKBOX_CLASSES),
|
80
|
+
"button": " ".join(BUTTON_CLASSES),
|
81
|
+
"radio": " ".join(RADIO_CLASSES),
|
82
|
+
"switch": " ".join(SWITCH_CLASSES),
|
83
|
+
"file": " ".join(FILE_CLASSES),
|
73
84
|
},
|
74
85
|
"site_title": self._get_config("SITE_TITLE", request) or self.site_title,
|
75
86
|
"site_header": self._get_config("SITE_HEADER", request) or self.site_header,
|
@@ -96,12 +96,23 @@
|
|
96
96
|
.removeClass(options.emptyCssClass)
|
97
97
|
.addClass(options.formCssClass)
|
98
98
|
.attr("id", options.prefix + "-" + nextIndex);
|
99
|
+
|
99
100
|
addInlineDeleteButton(row);
|
100
101
|
row.find("*").each(function () {
|
101
102
|
updateElementIndex(this, options.prefix, totalForms.val());
|
102
103
|
});
|
104
|
+
|
103
105
|
// Insert the new form when it has been fully edited.
|
104
|
-
|
106
|
+
// !CHANGED from original
|
107
|
+
if ($(template).parent().is("tbody")) {
|
108
|
+
row
|
109
|
+
.wrap('<tbody class="template"></tbody>')
|
110
|
+
.parent()
|
111
|
+
.insertBefore($(template).parent());
|
112
|
+
} else {
|
113
|
+
row.insertBefore($(template));
|
114
|
+
}
|
115
|
+
|
105
116
|
// Update number of total forms.
|
106
117
|
$(totalForms).val(parseInt(totalForms.val(), 10) + 1);
|
107
118
|
nextIndex += 1;
|
@@ -183,7 +194,13 @@
|
|
183
194
|
if (prevRow.length && prevRow.hasClass("row-form-errors")) {
|
184
195
|
prevRow.remove();
|
185
196
|
}
|
186
|
-
|
197
|
+
|
198
|
+
// !CHANGED from original
|
199
|
+
if (deleteButton.parent().parent().parent().parent().is("tbody")) {
|
200
|
+
row.parent().remove();
|
201
|
+
} else {
|
202
|
+
row.remove();
|
203
|
+
}
|
187
204
|
nextIndex -= 1;
|
188
205
|
// Pass the deleted form to the post-delete callback, if provided.
|
189
206
|
if (options.removed) {
|
@@ -245,8 +262,11 @@
|
|
245
262
|
}
|
246
263
|
|
247
264
|
// Create the delete buttons for all unsaved inlines:
|
265
|
+
// !CHANGED from original, added parent() and used find() instead of filter()
|
248
266
|
$this
|
249
|
-
.
|
267
|
+
.parent()
|
268
|
+
.parent()
|
269
|
+
.find(
|
250
270
|
"." +
|
251
271
|
options.formCssClass +
|
252
272
|
":not(.has_original):not(." +
|