django-unfold 0.22.0__py3-none-any.whl → 0.24.0__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- {django_unfold-0.22.0.dist-info → django_unfold-0.24.0.dist-info}/METADATA +102 -4
- {django_unfold-0.22.0.dist-info → django_unfold-0.24.0.dist-info}/RECORD +44 -43
- unfold/admin.py +29 -22
- unfold/apps.py +5 -0
- unfold/checks.py +1 -1
- unfold/contrib/filters/admin.py +116 -0
- unfold/contrib/filters/forms.py +29 -1
- 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/contrib/filters/templates/unfold/filters/filters_field.html +7 -0
- unfold/contrib/filters/templates/unfold/filters/filters_numeric_range.html +1 -1
- unfold/contrib/filters/templates/unfold/filters/filters_numeric_single.html +1 -1
- unfold/contrib/filters/templates/unfold/filters/filters_numeric_slider.html +1 -1
- unfold/contrib/import_export/admin.py +1 -1
- unfold/contrib/import_export/forms.py +6 -7
- unfold/contrib/import_export/templates/admin/import_export/export.html +1 -1
- unfold/contrib/import_export/templates/admin/import_export/import_form.html +2 -2
- unfold/forms.py +6 -1
- unfold/sites.py +3 -3
- unfold/static/unfold/css/styles.css +1 -1
- unfold/styles.css +11 -4
- unfold/templates/admin/actions.html +9 -9
- unfold/templates/admin/app_list.html +6 -8
- unfold/templates/admin/base.html +1 -3
- unfold/templates/admin/change_form.html +1 -2
- unfold/templates/admin/change_list.html +2 -2
- unfold/templates/admin/change_list_results.html +15 -3
- unfold/templates/admin/edit_inline/tabular.html +3 -3
- unfold/templates/admin/filter.html +2 -2
- unfold/templates/admin/search_form.html +10 -12
- unfold/templates/unfold/helpers/display_header.html +16 -13
- unfold/templates/unfold/helpers/tab_list.html +1 -1
- unfold/templates/unfold/layouts/base_simple.html +1 -1
- unfold/templates/unfold/widgets/date.html +1 -1
- unfold/templates/{admin → unfold}/widgets/related_widget_wrapper.html +4 -4
- unfold/templates/unfold/widgets/time.html +1 -1
- unfold/templatetags/unfold_list.py +8 -6
- unfold/widgets.py +18 -5
- {django_unfold-0.22.0.dist-info → django_unfold-0.24.0.dist-info}/LICENSE.md +0 -0
- {django_unfold-0.22.0.dist-info → django_unfold-0.24.0.dist-info}/WHEEL +0 -0
- /unfold/templates/{admin → unfold}/widgets/clearable_file_input.html +0 -0
- /unfold/templates/{admin → unfold}/widgets/radio.html +0 -0
- /unfold/templates/{admin → unfold}/widgets/radio_option.html +0 -0
- /unfold/templates/{admin → unfold}/widgets/split_datetime.html +0 -0
unfold/contrib/filters/forms.py
CHANGED
@@ -1,7 +1,35 @@
|
|
1
1
|
from django import forms
|
2
2
|
from django.utils.translation import gettext_lazy as _
|
3
3
|
|
4
|
-
from ...widgets import
|
4
|
+
from ...widgets import (
|
5
|
+
INPUT_CLASSES,
|
6
|
+
UnfoldAdminSelectWidget,
|
7
|
+
UnfoldAdminSplitDateTimeVerticalWidget,
|
8
|
+
UnfoldAdminTextInputWidget,
|
9
|
+
)
|
10
|
+
|
11
|
+
|
12
|
+
class SearchForm(forms.Form):
|
13
|
+
def __init__(self, name, label, *args, **kwargs):
|
14
|
+
super().__init__(*args, **kwargs)
|
15
|
+
|
16
|
+
self.fields[name] = forms.CharField(
|
17
|
+
label=label,
|
18
|
+
required=False,
|
19
|
+
widget=UnfoldAdminTextInputWidget,
|
20
|
+
)
|
21
|
+
|
22
|
+
|
23
|
+
class DropdownForm(forms.Form):
|
24
|
+
def __init__(self, name, label, choices, *args, **kwargs):
|
25
|
+
super().__init__(*args, **kwargs)
|
26
|
+
|
27
|
+
self.fields[name] = forms.ChoiceField(
|
28
|
+
label=label,
|
29
|
+
required=False,
|
30
|
+
choices=choices,
|
31
|
+
widget=UnfoldAdminSelectWidget,
|
32
|
+
)
|
5
33
|
|
6
34
|
|
7
35
|
class SingleNumericForm(forms.Form):
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
{% with choices.0 as choice %}
|
4
4
|
<div class="flex flex-col mb-6">
|
5
|
-
<h3 class="font-medium mb-
|
5
|
+
<h3 class="font-medium mb-2 text-gray-700 text-sm dark:text-gray-200">{% blocktrans with filter_title=title %}By {{ filter_title }}{% endblocktrans %}</h3>
|
6
6
|
|
7
7
|
<div class="flex flex-col space-y-4">
|
8
8
|
{% for field in choice.form %}
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
{% with choices.0 as choice %}
|
4
4
|
<div class="flex flex-col mb-6">
|
5
|
-
<h3 class="font-medium mb-
|
5
|
+
<h3 class="font-medium mb-2 text-gray-700 text-sm dark:text-gray-200">{% blocktrans with filter_title=title %}By {{ filter_title }}{% endblocktrans %}</h3>
|
6
6
|
|
7
7
|
<div class="flex flex-col space-y-4">
|
8
8
|
{% for field in choice.form %}
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
{% with choices.0 as choice %}
|
4
4
|
<div class="flex flex-col mb-6">
|
5
|
-
<h3 class="font-medium mb-
|
5
|
+
<h3 class="font-medium mb-2 text-gray-700 text-sm dark:text-gray-200">{% blocktrans with filter_title=title %}By {{ filter_title }}{% endblocktrans %}</h3>
|
6
6
|
|
7
7
|
<div class="flex flex-row gap-4">
|
8
8
|
{% for field in choice.form %}
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
{% with choices.0 as choice %}
|
4
4
|
<div class="flex flex-col mb-6">
|
5
|
-
<h3 class="font-medium mb-
|
5
|
+
<h3 class="font-medium mb-2 text-gray-700 text-sm dark:text-gray-200">{% blocktrans with filter_title=title %}By {{ filter_title }}{% endblocktrans %}</h3>
|
6
6
|
|
7
7
|
{% for field in choice.form %}
|
8
8
|
<div class="flex flex-row flex-wrap group relative{% if field.errors %} errors{% endif %}">
|
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
{% with choices.0 as choice %}
|
5
5
|
<div class="admin-numeric-filter-wrapper mb-6">
|
6
|
-
<h3 class="font-medium mb-
|
6
|
+
<h3 class="font-medium mb-2 text-gray-700 text-sm dark:text-gray-200">
|
7
7
|
{% blocktrans with filter_title=title %}By {{ filter_title }}{% endblocktrans %}
|
8
8
|
</h3>
|
9
9
|
|
@@ -1,16 +1,15 @@
|
|
1
|
-
from import_export.forms import
|
2
|
-
from import_export.forms import ImportForm as BaseImportForm
|
1
|
+
from import_export.forms import ImportExportFormBase as BaseImportExportFormBase
|
3
2
|
from unfold.widgets import SELECT_CLASSES, UnfoldAdminFileFieldWidget
|
4
3
|
|
5
4
|
|
6
|
-
class ImportForm(
|
5
|
+
class ImportForm(BaseImportExportFormBase):
|
7
6
|
def __init__(self, *args, **kwargs):
|
8
7
|
super().__init__(*args, **kwargs)
|
9
|
-
self.fields["
|
10
|
-
self.fields["
|
8
|
+
self.fields["resource"].widget = UnfoldAdminFileFieldWidget()
|
9
|
+
self.fields["format"].widget.attrs["class"] = " ".join(SELECT_CLASSES)
|
11
10
|
|
12
11
|
|
13
|
-
class ExportForm(
|
12
|
+
class ExportForm(BaseImportExportFormBase):
|
14
13
|
def __init__(self, *args, **kwargs):
|
15
14
|
super().__init__(*args, **kwargs)
|
16
|
-
self.fields["
|
15
|
+
self.fields["format"].widget.attrs["class"] = " ".join(SELECT_CLASSES)
|
@@ -37,7 +37,7 @@
|
|
37
37
|
{% csrf_token %}
|
38
38
|
|
39
39
|
<fieldset class="border border-gray-200 mb-8 rounded-md pt-3 px-3 shadow-sm dark:border-gray-800">
|
40
|
-
{% include "unfold/helpers/field.html" with field=form.
|
40
|
+
{% include "unfold/helpers/field.html" with field=form.format %}
|
41
41
|
</fieldset>
|
42
42
|
|
43
43
|
<button type="submit" class="bg-primary-600 border border-transparent font-medium px-3 py-2 rounded-md text-sm text-white">
|
@@ -22,9 +22,9 @@
|
|
22
22
|
</p>
|
23
23
|
|
24
24
|
<fieldset class="border border-gray-200 mb-8 rounded-md pt-3 px-3 shadow-sm dark:border-gray-800">
|
25
|
-
{% include "unfold/helpers/field.html" with field=form.
|
25
|
+
{% include "unfold/helpers/field.html" with field=form.resource %}
|
26
26
|
|
27
|
-
{% include "unfold/helpers/field.html" with field=form.
|
27
|
+
{% include "unfold/helpers/field.html" with field=form.format %}
|
28
28
|
</fieldset>
|
29
29
|
|
30
30
|
|
unfold/forms.py
CHANGED
@@ -22,7 +22,12 @@ from .widgets import BASE_INPUT_CLASSES, INPUT_CLASSES, SELECT_CLASSES
|
|
22
22
|
class ActionForm(forms.Form):
|
23
23
|
action = forms.ChoiceField(
|
24
24
|
label="",
|
25
|
-
widget=forms.Select(
|
25
|
+
widget=forms.Select(
|
26
|
+
{
|
27
|
+
"class": " ".join([*SELECT_CLASSES, "max-w-full", "lg:!w-64"]),
|
28
|
+
"x-model": "action",
|
29
|
+
}
|
30
|
+
),
|
26
31
|
)
|
27
32
|
|
28
33
|
select_across = forms.BooleanField(
|
unfold/sites.py
CHANGED
@@ -205,7 +205,7 @@ class UnfoldAdminSite(AdminSite):
|
|
205
205
|
|
206
206
|
from .forms import AdminOwnPasswordChangeForm
|
207
207
|
|
208
|
-
url = reverse("
|
208
|
+
url = reverse(f"{self.name}:password_change_done", current_app=self.name)
|
209
209
|
defaults = {
|
210
210
|
"form_class": AdminOwnPasswordChangeForm,
|
211
211
|
"success_url": url,
|
@@ -224,9 +224,9 @@ class UnfoldAdminSite(AdminSite):
|
|
224
224
|
if not isinstance(link, str):
|
225
225
|
link = str(link)
|
226
226
|
|
227
|
-
if link in request.path and link != reverse_lazy("
|
227
|
+
if link in request.path and link != reverse_lazy(f"{self.name}:index"):
|
228
228
|
return True
|
229
|
-
elif link == request.path == reverse_lazy("
|
229
|
+
elif link == request.path == reverse_lazy(f"{self.name}:index"):
|
230
230
|
return True
|
231
231
|
|
232
232
|
return False
|