django-unfold 0.67.0__py3-none-any.whl → 0.69.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.67.0.dist-info → django_unfold-0.69.0.dist-info}/METADATA +33 -41
- {django_unfold-0.67.0.dist-info → django_unfold-0.69.0.dist-info}/RECORD +54 -47
- unfold/admin.py +46 -15
- unfold/components.py +2 -2
- unfold/contrib/filters/admin/choice_filters.py +13 -1
- unfold/contrib/filters/admin/mixins.py +3 -3
- unfold/contrib/filters/admin/numeric_filters.py +6 -6
- unfold/contrib/forms/widgets.py +5 -5
- unfold/contrib/inlines/admin.py +3 -3
- unfold/contrib/inlines/forms.py +5 -4
- unfold/dataclasses.py +13 -13
- unfold/datasets.py +90 -0
- unfold/decorators.py +19 -19
- unfold/fields.py +3 -5
- unfold/forms.py +41 -22
- unfold/mixins/__init__.py +2 -1
- unfold/mixins/action_model_admin.py +11 -10
- unfold/mixins/base_model_admin.py +6 -6
- unfold/mixins/dataset_model_admin.py +62 -0
- unfold/settings.py +1 -0
- unfold/sites.py +19 -18
- unfold/static/admin/js/actions.js +246 -0
- unfold/static/unfold/css/styles.css +2 -2
- unfold/static/unfold/fonts/material-symbols/Material-Symbols-Outlined.woff2 +0 -0
- unfold/static/unfold/js/app.js +3 -1
- unfold/styles.css +21 -16
- unfold/templates/admin/actions.html +2 -2
- unfold/templates/admin/change_form.html +10 -2
- unfold/templates/admin/change_list.html +1 -1
- unfold/templates/admin/change_list_results.html +10 -62
- unfold/templates/admin/dataset_actions.html +50 -0
- unfold/templates/admin/edit_inline/stacked.html +2 -8
- unfold/templates/admin/edit_inline/tabular.html +1 -7
- unfold/templates/admin/includes/fieldset.html +1 -3
- unfold/templates/admin/search_form.html +6 -4
- unfold/templates/registration/password_change_done.html +3 -4
- unfold/templates/registration/password_change_form.html +10 -6
- unfold/templates/unfold/helpers/change_list_actions.html +1 -1
- unfold/templates/unfold/helpers/change_list_headers.html +65 -0
- unfold/templates/unfold/helpers/dataset.html +31 -0
- unfold/templates/unfold/helpers/edit_inline/tabular_field.html +1 -1
- unfold/templates/unfold/helpers/empty_results.html +6 -4
- unfold/templates/unfold/helpers/field_readonly_value_file.html +1 -1
- unfold/templates/unfold/helpers/fieldsets_tabs.html +9 -11
- unfold/templates/unfold/helpers/inline_heading.html +11 -0
- unfold/templates/unfold/helpers/tab_items.html +9 -1
- unfold/templatetags/unfold.py +64 -82
- unfold/templatetags/unfold_list.py +76 -8
- unfold/typing.py +5 -6
- unfold/utils.py +9 -9
- unfold/views.py +15 -1
- unfold/widgets.py +31 -31
- {django_unfold-0.67.0.dist-info → django_unfold-0.69.0.dist-info}/WHEEL +0 -0
- {django_unfold-0.67.0.dist-info → django_unfold-0.69.0.dist-info}/licenses/LICENSE.md +0 -0
unfold/widgets.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
from
|
|
1
|
+
from collections.abc import Callable
|
|
2
|
+
from typing import Any
|
|
2
3
|
|
|
3
4
|
from django.contrib.admin.options import VERTICAL
|
|
4
5
|
from django.contrib.admin.sites import AdminSite
|
|
@@ -175,7 +176,7 @@ CHECKBOX_CLASSES = [
|
|
|
175
176
|
"focus:outline-offset-2",
|
|
176
177
|
"focus:outline-primary-500",
|
|
177
178
|
"after:absolute",
|
|
178
|
-
"after:content-['
|
|
179
|
+
r"after:content-['check\_small']",
|
|
179
180
|
"after:flex!",
|
|
180
181
|
"after:h-4",
|
|
181
182
|
"after:items-center",
|
|
@@ -184,7 +185,6 @@ CHECKBOX_CLASSES = [
|
|
|
184
185
|
"after:material-symbols-outlined",
|
|
185
186
|
"after:-ml-px",
|
|
186
187
|
"after:-mt-px",
|
|
187
|
-
"after:text-sm!",
|
|
188
188
|
"after:text-white",
|
|
189
189
|
"after:transition-all",
|
|
190
190
|
"after:w-4",
|
|
@@ -337,7 +337,7 @@ class UnfoldPrefixSuffixMixin:
|
|
|
337
337
|
class UnfoldAdminTextInputWidget(UnfoldPrefixSuffixMixin, AdminTextInputWidget):
|
|
338
338
|
template_name = "unfold/widgets/text.html"
|
|
339
339
|
|
|
340
|
-
def __init__(self, attrs:
|
|
340
|
+
def __init__(self, attrs: dict[str, Any] | None = None) -> None:
|
|
341
341
|
super().__init__(
|
|
342
342
|
attrs={
|
|
343
343
|
**(attrs or {}),
|
|
@@ -351,7 +351,7 @@ class UnfoldAdminTextInputWidget(UnfoldPrefixSuffixMixin, AdminTextInputWidget):
|
|
|
351
351
|
class UnfoldAdminURLInputWidget(AdminURLFieldWidget):
|
|
352
352
|
template_name = "unfold/widgets/url.html"
|
|
353
353
|
|
|
354
|
-
def __init__(self, attrs:
|
|
354
|
+
def __init__(self, attrs: dict[str, Any] | None = None) -> None:
|
|
355
355
|
super().__init__(
|
|
356
356
|
attrs={
|
|
357
357
|
**(attrs or {}),
|
|
@@ -363,7 +363,7 @@ class UnfoldAdminURLInputWidget(AdminURLFieldWidget):
|
|
|
363
363
|
|
|
364
364
|
|
|
365
365
|
class UnfoldAdminColorInputWidget(AdminTextInputWidget):
|
|
366
|
-
def __init__(self, attrs:
|
|
366
|
+
def __init__(self, attrs: dict[str, Any] | None = None) -> None:
|
|
367
367
|
super().__init__(
|
|
368
368
|
attrs={
|
|
369
369
|
**(attrs or {}),
|
|
@@ -376,7 +376,7 @@ class UnfoldAdminColorInputWidget(AdminTextInputWidget):
|
|
|
376
376
|
|
|
377
377
|
|
|
378
378
|
class UnfoldAdminUUIDInputWidget(AdminUUIDInputWidget):
|
|
379
|
-
def __init__(self, attrs:
|
|
379
|
+
def __init__(self, attrs: dict[str, Any] | None = None) -> None:
|
|
380
380
|
super().__init__(
|
|
381
381
|
attrs={
|
|
382
382
|
**(attrs or {}),
|
|
@@ -390,7 +390,7 @@ class UnfoldAdminUUIDInputWidget(AdminUUIDInputWidget):
|
|
|
390
390
|
class UnfoldAdminIntegerRangeWidget(MultiWidget):
|
|
391
391
|
template_name = "unfold/widgets/range.html"
|
|
392
392
|
|
|
393
|
-
def __init__(self, attrs:
|
|
393
|
+
def __init__(self, attrs: dict[str, Any] | None = None) -> None:
|
|
394
394
|
if attrs is None:
|
|
395
395
|
attrs = {}
|
|
396
396
|
|
|
@@ -402,14 +402,14 @@ class UnfoldAdminIntegerRangeWidget(MultiWidget):
|
|
|
402
402
|
|
|
403
403
|
super().__init__(_widgets, attrs)
|
|
404
404
|
|
|
405
|
-
def decompress(self, value:
|
|
405
|
+
def decompress(self, value: str | None) -> tuple[Callable | None, ...]:
|
|
406
406
|
if value:
|
|
407
407
|
return value.lower, value.upper
|
|
408
408
|
return None, None
|
|
409
409
|
|
|
410
410
|
|
|
411
411
|
class UnfoldAdminEmailInputWidget(AdminEmailInputWidget):
|
|
412
|
-
def __init__(self, attrs:
|
|
412
|
+
def __init__(self, attrs: dict[str, Any] | None = None) -> None:
|
|
413
413
|
super().__init__(
|
|
414
414
|
attrs={
|
|
415
415
|
**(attrs or {}),
|
|
@@ -459,7 +459,7 @@ class UnfoldAdminDateWidget(AdminDateWidget):
|
|
|
459
459
|
template_name = "unfold/widgets/date.html"
|
|
460
460
|
|
|
461
461
|
def __init__(
|
|
462
|
-
self, attrs:
|
|
462
|
+
self, attrs: dict[str, Any] | None = None, format: str | None = None
|
|
463
463
|
) -> None:
|
|
464
464
|
attrs = {
|
|
465
465
|
**(attrs or {}),
|
|
@@ -486,7 +486,7 @@ class UnfoldAdminSingleDateWidget(AdminDateWidget):
|
|
|
486
486
|
template_name = "unfold/widgets/date.html"
|
|
487
487
|
|
|
488
488
|
def __init__(
|
|
489
|
-
self, attrs:
|
|
489
|
+
self, attrs: dict[str, Any] | None = None, format: str | None = None
|
|
490
490
|
) -> None:
|
|
491
491
|
attrs = {
|
|
492
492
|
**(attrs or {}),
|
|
@@ -506,7 +506,7 @@ class UnfoldAdminTimeWidget(AdminTimeWidget):
|
|
|
506
506
|
template_name = "unfold/widgets/time.html"
|
|
507
507
|
|
|
508
508
|
def __init__(
|
|
509
|
-
self, attrs:
|
|
509
|
+
self, attrs: dict[str, Any] | None = None, format: str | None = None
|
|
510
510
|
) -> None:
|
|
511
511
|
attrs = {
|
|
512
512
|
**(attrs or {}),
|
|
@@ -533,7 +533,7 @@ class UnfoldAdminSingleTimeWidget(AdminTimeWidget):
|
|
|
533
533
|
template_name = "unfold/widgets/time.html"
|
|
534
534
|
|
|
535
535
|
def __init__(
|
|
536
|
-
self, attrs:
|
|
536
|
+
self, attrs: dict[str, Any] | None = None, format: str | None = None
|
|
537
537
|
) -> None:
|
|
538
538
|
attrs = {
|
|
539
539
|
**(attrs or {}),
|
|
@@ -552,7 +552,7 @@ class UnfoldAdminSingleTimeWidget(AdminTimeWidget):
|
|
|
552
552
|
class UnfoldAdminTextareaWidget(AdminTextareaWidget):
|
|
553
553
|
template_name = "unfold/widgets/textarea.html"
|
|
554
554
|
|
|
555
|
-
def __init__(self, attrs:
|
|
555
|
+
def __init__(self, attrs: dict[str, Any] | None = None) -> None:
|
|
556
556
|
attrs = attrs or {}
|
|
557
557
|
|
|
558
558
|
super().__init__(
|
|
@@ -570,7 +570,7 @@ class UnfoldAdminTextareaWidget(AdminTextareaWidget):
|
|
|
570
570
|
|
|
571
571
|
|
|
572
572
|
class UnfoldAdminExpandableTextareaWidget(UnfoldAdminTextareaWidget):
|
|
573
|
-
def __init__(self, attrs:
|
|
573
|
+
def __init__(self, attrs: dict[str, Any] | None = None) -> None:
|
|
574
574
|
attrs = attrs or {}
|
|
575
575
|
|
|
576
576
|
attrs.update({"rows": 2})
|
|
@@ -593,7 +593,7 @@ class UnfoldAdminExpandableTextareaWidget(UnfoldAdminTextareaWidget):
|
|
|
593
593
|
class UnfoldAdminSplitDateTimeWidget(AdminSplitDateTime):
|
|
594
594
|
template_name = "unfold/widgets/split_datetime.html"
|
|
595
595
|
|
|
596
|
-
def __init__(self, attrs:
|
|
596
|
+
def __init__(self, attrs: dict[str, Any] | None = None) -> None:
|
|
597
597
|
widgets = [
|
|
598
598
|
UnfoldAdminDateWidget(attrs={"placeholder": _("Date")}),
|
|
599
599
|
UnfoldAdminTimeWidget(attrs={"placeholder": _("Time")}),
|
|
@@ -613,11 +613,11 @@ class UnfoldAdminSplitDateTimeVerticalWidget(AdminSplitDateTime):
|
|
|
613
613
|
|
|
614
614
|
def __init__(
|
|
615
615
|
self,
|
|
616
|
-
attrs:
|
|
617
|
-
date_attrs:
|
|
618
|
-
time_attrs:
|
|
619
|
-
date_label:
|
|
620
|
-
time_label:
|
|
616
|
+
attrs: dict[str, Any] | None = None,
|
|
617
|
+
date_attrs: dict[str, Any] | None = None,
|
|
618
|
+
time_attrs: dict[str, Any] | None = None,
|
|
619
|
+
date_label: str | None = None,
|
|
620
|
+
time_label: str | None = None,
|
|
621
621
|
) -> None:
|
|
622
622
|
self.date_label = date_label
|
|
623
623
|
self.time_label = time_label
|
|
@@ -629,7 +629,7 @@ class UnfoldAdminSplitDateTimeVerticalWidget(AdminSplitDateTime):
|
|
|
629
629
|
MultiWidget.__init__(self, widgets, attrs)
|
|
630
630
|
|
|
631
631
|
def get_context(
|
|
632
|
-
self, name: str, value: Any, attrs:
|
|
632
|
+
self, name: str, value: Any, attrs: dict[str, Any] | None
|
|
633
633
|
) -> dict[str, Any]:
|
|
634
634
|
context = super().get_context(name, value, attrs)
|
|
635
635
|
|
|
@@ -647,7 +647,7 @@ class UnfoldAdminSplitDateTimeVerticalWidget(AdminSplitDateTime):
|
|
|
647
647
|
|
|
648
648
|
|
|
649
649
|
class UnfoldAdminIntegerFieldWidget(AdminIntegerFieldWidget):
|
|
650
|
-
def __init__(self, attrs:
|
|
650
|
+
def __init__(self, attrs: dict[str, Any] | None = None) -> None:
|
|
651
651
|
super().__init__(
|
|
652
652
|
attrs={
|
|
653
653
|
**(attrs or {}),
|
|
@@ -659,7 +659,7 @@ class UnfoldAdminIntegerFieldWidget(AdminIntegerFieldWidget):
|
|
|
659
659
|
|
|
660
660
|
|
|
661
661
|
class UnfoldAdminDecimalFieldWidget(AdminIntegerFieldWidget):
|
|
662
|
-
def __init__(self, attrs:
|
|
662
|
+
def __init__(self, attrs: dict[str, Any] | None = None) -> None:
|
|
663
663
|
super().__init__(
|
|
664
664
|
attrs={
|
|
665
665
|
**(attrs or {}),
|
|
@@ -671,7 +671,7 @@ class UnfoldAdminDecimalFieldWidget(AdminIntegerFieldWidget):
|
|
|
671
671
|
|
|
672
672
|
|
|
673
673
|
class UnfoldAdminBigIntegerFieldWidget(AdminBigIntegerFieldWidget):
|
|
674
|
-
def __init__(self, attrs:
|
|
674
|
+
def __init__(self, attrs: dict[str, Any] | None = None) -> None:
|
|
675
675
|
super().__init__(
|
|
676
676
|
attrs={
|
|
677
677
|
**(attrs or {}),
|
|
@@ -773,7 +773,7 @@ class UnfoldAdminRadioSelectWidget(AdminRadioSelect):
|
|
|
773
773
|
template_name = "unfold/widgets/radio.html"
|
|
774
774
|
option_template_name = "unfold/widgets/radio_option.html"
|
|
775
775
|
|
|
776
|
-
def __init__(self, radio_style:
|
|
776
|
+
def __init__(self, radio_style: int | None = None, *args, **kwargs):
|
|
777
777
|
super().__init__(*args, **kwargs)
|
|
778
778
|
|
|
779
779
|
if radio_style is None:
|
|
@@ -832,7 +832,7 @@ except ImportError:
|
|
|
832
832
|
|
|
833
833
|
class UnfoldBooleanWidget(CheckboxInput):
|
|
834
834
|
def __init__(
|
|
835
|
-
self, attrs:
|
|
835
|
+
self, attrs: dict[str, Any] | None = None, check_test: Callable = None
|
|
836
836
|
) -> None:
|
|
837
837
|
if attrs is None:
|
|
838
838
|
attrs = {}
|
|
@@ -850,7 +850,7 @@ class UnfoldBooleanWidget(CheckboxInput):
|
|
|
850
850
|
|
|
851
851
|
class UnfoldBooleanSwitchWidget(CheckboxInput):
|
|
852
852
|
def __init__(
|
|
853
|
-
self, attrs:
|
|
853
|
+
self, attrs: dict[str, Any] | None = None, check_test: Callable = None
|
|
854
854
|
) -> None:
|
|
855
855
|
super().__init__(
|
|
856
856
|
attrs={
|
|
@@ -874,8 +874,8 @@ class UnfoldForeignKeyRawIdWidget(ForeignKeyRawIdWidget):
|
|
|
874
874
|
self,
|
|
875
875
|
rel: ForeignObjectRel,
|
|
876
876
|
admin_site: AdminSite,
|
|
877
|
-
attrs:
|
|
878
|
-
using:
|
|
877
|
+
attrs: dict | None = None,
|
|
878
|
+
using: Any | None = None,
|
|
879
879
|
) -> None:
|
|
880
880
|
attrs = {
|
|
881
881
|
**(attrs or {}),
|
|
File without changes
|
|
File without changes
|