django-unfold 0.46.0__py3-none-any.whl → 0.48.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.46.0.dist-info → django_unfold-0.48.0.dist-info}/METADATA +5 -6
- {django_unfold-0.46.0.dist-info → django_unfold-0.48.0.dist-info}/RECORD +52 -43
- {django_unfold-0.46.0.dist-info → django_unfold-0.48.0.dist-info}/WHEEL +1 -1
- unfold/admin.py +15 -16
- unfold/checks.py +4 -4
- unfold/components.py +5 -5
- unfold/contrib/filters/admin/__init__.py +43 -0
- unfold/contrib/filters/admin/autocomplete_filters.py +16 -0
- unfold/contrib/filters/admin/datetime_filters.py +212 -0
- unfold/contrib/filters/admin/dropdown_filters.py +100 -0
- unfold/contrib/filters/admin/mixins.py +146 -0
- unfold/contrib/filters/admin/numeric_filters.py +196 -0
- unfold/contrib/filters/admin/text_filters.py +65 -0
- unfold/contrib/filters/admin.py +32 -32
- unfold/contrib/filters/forms.py +68 -17
- unfold/contrib/forms/widgets.py +9 -9
- unfold/contrib/inlines/checks.py +2 -4
- unfold/contrib/simple_history/templates/simple_history/object_history.html +17 -1
- unfold/contrib/simple_history/templates/simple_history/object_history_list.html +1 -1
- unfold/dataclasses.py +9 -2
- unfold/decorators.py +4 -3
- unfold/settings.py +4 -2
- unfold/sites.py +176 -140
- unfold/static/unfold/css/styles.css +1 -1
- unfold/static/unfold/js/app.js +2 -2
- unfold/templates/admin/app_index.html +1 -5
- unfold/templates/admin/base_site.html +1 -1
- unfold/templates/admin/filter.html +1 -1
- unfold/templates/admin/index.html +1 -5
- unfold/templates/admin/login.html +1 -1
- unfold/templates/admin/search_form.html +4 -2
- unfold/templates/unfold/helpers/account_links.html +1 -1
- unfold/templates/unfold/helpers/actions_row.html +1 -1
- unfold/templates/unfold/helpers/change_list_filter.html +2 -2
- unfold/templates/unfold/helpers/change_list_filter_actions.html +1 -1
- unfold/templates/unfold/helpers/header_back_button.html +2 -2
- unfold/templates/unfold/helpers/language_switch.html +1 -1
- unfold/templates/unfold/helpers/navigation_header.html +15 -5
- unfold/templates/unfold/helpers/site_branding.html +9 -0
- unfold/templates/unfold/helpers/site_dropdown.html +19 -0
- unfold/templates/unfold/helpers/site_icon.html +10 -2
- unfold/templates/unfold/helpers/tab_list.html +7 -1
- unfold/templates/unfold/helpers/theme_switch.html +1 -1
- unfold/templates/unfold/layouts/base.html +1 -5
- unfold/templates/unfold/layouts/skeleton.html +1 -1
- unfold/templatetags/unfold.py +55 -22
- unfold/templatetags/unfold_list.py +2 -2
- unfold/typing.py +5 -4
- unfold/utils.py +3 -2
- unfold/views.py +2 -2
- unfold/widgets.py +27 -27
- {django_unfold-0.46.0.dist-info → django_unfold-0.48.0.dist-info}/LICENSE.md +0 -0
unfold/widgets.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
from typing import Any, Callable,
|
1
|
+
from typing import Any, Callable, Optional, Union
|
2
2
|
|
3
3
|
from django.contrib.admin.options import VERTICAL
|
4
4
|
from django.contrib.admin.sites import AdminSite
|
@@ -255,7 +255,7 @@ SWITCH_CLASSES = [
|
|
255
255
|
|
256
256
|
|
257
257
|
class UnfoldAdminTextInputWidget(AdminTextInputWidget):
|
258
|
-
def __init__(self, attrs: Optional[
|
258
|
+
def __init__(self, attrs: Optional[dict[str, Any]] = None) -> None:
|
259
259
|
super().__init__(
|
260
260
|
attrs={
|
261
261
|
**(attrs or {}),
|
@@ -269,7 +269,7 @@ class UnfoldAdminTextInputWidget(AdminTextInputWidget):
|
|
269
269
|
class UnfoldAdminURLInputWidget(AdminURLFieldWidget):
|
270
270
|
template_name = "unfold/widgets/url.html"
|
271
271
|
|
272
|
-
def __init__(self, attrs: Optional[
|
272
|
+
def __init__(self, attrs: Optional[dict[str, Any]] = None) -> None:
|
273
273
|
super().__init__(
|
274
274
|
attrs={
|
275
275
|
**(attrs or {}),
|
@@ -281,7 +281,7 @@ class UnfoldAdminURLInputWidget(AdminURLFieldWidget):
|
|
281
281
|
|
282
282
|
|
283
283
|
class UnfoldAdminColorInputWidget(AdminTextInputWidget):
|
284
|
-
def __init__(self, attrs: Optional[
|
284
|
+
def __init__(self, attrs: Optional[dict[str, Any]] = None) -> None:
|
285
285
|
super().__init__(
|
286
286
|
attrs={
|
287
287
|
**(attrs or {}),
|
@@ -294,7 +294,7 @@ class UnfoldAdminColorInputWidget(AdminTextInputWidget):
|
|
294
294
|
|
295
295
|
|
296
296
|
class UnfoldAdminUUIDInputWidget(AdminUUIDInputWidget):
|
297
|
-
def __init__(self, attrs: Optional[
|
297
|
+
def __init__(self, attrs: Optional[dict[str, Any]] = None) -> None:
|
298
298
|
super().__init__(
|
299
299
|
attrs={
|
300
300
|
**(attrs or {}),
|
@@ -308,7 +308,7 @@ class UnfoldAdminUUIDInputWidget(AdminUUIDInputWidget):
|
|
308
308
|
class UnfoldAdminIntegerRangeWidget(MultiWidget):
|
309
309
|
template_name = "unfold/widgets/range.html"
|
310
310
|
|
311
|
-
def __init__(self, attrs: Optional[
|
311
|
+
def __init__(self, attrs: Optional[dict[str, Any]] = None) -> None:
|
312
312
|
if attrs is None:
|
313
313
|
attrs = {}
|
314
314
|
|
@@ -320,14 +320,14 @@ class UnfoldAdminIntegerRangeWidget(MultiWidget):
|
|
320
320
|
|
321
321
|
super().__init__(_widgets, attrs)
|
322
322
|
|
323
|
-
def decompress(self, value: Union[str, None]) ->
|
323
|
+
def decompress(self, value: Union[str, None]) -> tuple[Optional[Callable], ...]:
|
324
324
|
if value:
|
325
325
|
return value.lower, value.upper
|
326
326
|
return None, None
|
327
327
|
|
328
328
|
|
329
329
|
class UnfoldAdminEmailInputWidget(AdminEmailInputWidget):
|
330
|
-
def __init__(self, attrs: Optional[
|
330
|
+
def __init__(self, attrs: Optional[dict[str, Any]] = None) -> None:
|
331
331
|
super().__init__(
|
332
332
|
attrs={
|
333
333
|
**(attrs or {}),
|
@@ -374,7 +374,7 @@ class UnfoldAdminDateWidget(AdminDateWidget):
|
|
374
374
|
template_name = "unfold/widgets/date.html"
|
375
375
|
|
376
376
|
def __init__(
|
377
|
-
self, attrs: Optional[
|
377
|
+
self, attrs: Optional[dict[str, Any]] = None, format: Optional[str] = None
|
378
378
|
) -> None:
|
379
379
|
attrs = {
|
380
380
|
**(attrs or {}),
|
@@ -394,7 +394,7 @@ class UnfoldAdminSingleDateWidget(AdminDateWidget):
|
|
394
394
|
template_name = "unfold/widgets/date.html"
|
395
395
|
|
396
396
|
def __init__(
|
397
|
-
self, attrs: Optional[
|
397
|
+
self, attrs: Optional[dict[str, Any]] = None, format: Optional[str] = None
|
398
398
|
) -> None:
|
399
399
|
attrs = {
|
400
400
|
**(attrs or {}),
|
@@ -414,7 +414,7 @@ class UnfoldAdminTimeWidget(AdminTimeWidget):
|
|
414
414
|
template_name = "unfold/widgets/time.html"
|
415
415
|
|
416
416
|
def __init__(
|
417
|
-
self, attrs: Optional[
|
417
|
+
self, attrs: Optional[dict[str, Any]] = None, format: Optional[str] = None
|
418
418
|
) -> None:
|
419
419
|
attrs = {
|
420
420
|
**(attrs or {}),
|
@@ -434,7 +434,7 @@ class UnfoldAdminSingleTimeWidget(AdminTimeWidget):
|
|
434
434
|
template_name = "unfold/widgets/time.html"
|
435
435
|
|
436
436
|
def __init__(
|
437
|
-
self, attrs: Optional[
|
437
|
+
self, attrs: Optional[dict[str, Any]] = None, format: Optional[str] = None
|
438
438
|
) -> None:
|
439
439
|
attrs = {
|
440
440
|
**(attrs or {}),
|
@@ -453,7 +453,7 @@ class UnfoldAdminSingleTimeWidget(AdminTimeWidget):
|
|
453
453
|
class UnfoldAdminTextareaWidget(AdminTextareaWidget):
|
454
454
|
template_name = "unfold/widgets/textarea.html"
|
455
455
|
|
456
|
-
def __init__(self, attrs: Optional[
|
456
|
+
def __init__(self, attrs: Optional[dict[str, Any]] = None) -> None:
|
457
457
|
attrs = attrs or {}
|
458
458
|
|
459
459
|
super().__init__(
|
@@ -473,7 +473,7 @@ class UnfoldAdminTextareaWidget(AdminTextareaWidget):
|
|
473
473
|
class UnfoldAdminExpandableTextareaWidget(AdminTextareaWidget):
|
474
474
|
template_name = "unfold/widgets/textarea_expandable.html"
|
475
475
|
|
476
|
-
def __init__(self, attrs: Optional[
|
476
|
+
def __init__(self, attrs: Optional[dict[str, Any]] = None) -> None:
|
477
477
|
attrs = attrs or {}
|
478
478
|
|
479
479
|
attrs.update({"rows": 2})
|
@@ -496,7 +496,7 @@ class UnfoldAdminExpandableTextareaWidget(AdminTextareaWidget):
|
|
496
496
|
class UnfoldAdminSplitDateTimeWidget(AdminSplitDateTime):
|
497
497
|
template_name = "unfold/widgets/split_datetime.html"
|
498
498
|
|
499
|
-
def __init__(self, attrs: Optional[
|
499
|
+
def __init__(self, attrs: Optional[dict[str, Any]] = None) -> None:
|
500
500
|
widgets = [UnfoldAdminDateWidget, UnfoldAdminTimeWidget]
|
501
501
|
MultiWidget.__init__(self, widgets, attrs)
|
502
502
|
|
@@ -506,9 +506,9 @@ class UnfoldAdminSplitDateTimeVerticalWidget(AdminSplitDateTime):
|
|
506
506
|
|
507
507
|
def __init__(
|
508
508
|
self,
|
509
|
-
attrs: Optional[
|
510
|
-
date_attrs: Optional[
|
511
|
-
time_attrs: Optional[
|
509
|
+
attrs: Optional[dict[str, Any]] = None,
|
510
|
+
date_attrs: Optional[dict[str, Any]] = None,
|
511
|
+
time_attrs: Optional[dict[str, Any]] = None,
|
512
512
|
date_label: Optional[str] = None,
|
513
513
|
time_label: Optional[str] = None,
|
514
514
|
) -> None:
|
@@ -522,8 +522,8 @@ class UnfoldAdminSplitDateTimeVerticalWidget(AdminSplitDateTime):
|
|
522
522
|
MultiWidget.__init__(self, widgets, attrs)
|
523
523
|
|
524
524
|
def get_context(
|
525
|
-
self, name: str, value: Any, attrs: Optional[
|
526
|
-
) ->
|
525
|
+
self, name: str, value: Any, attrs: Optional[dict[str, Any]]
|
526
|
+
) -> dict[str, Any]:
|
527
527
|
context = super().get_context(name, value, attrs)
|
528
528
|
|
529
529
|
if self.date_label is not None:
|
@@ -540,7 +540,7 @@ class UnfoldAdminSplitDateTimeVerticalWidget(AdminSplitDateTime):
|
|
540
540
|
|
541
541
|
|
542
542
|
class UnfoldAdminIntegerFieldWidget(AdminIntegerFieldWidget):
|
543
|
-
def __init__(self, attrs: Optional[
|
543
|
+
def __init__(self, attrs: Optional[dict[str, Any]] = None) -> None:
|
544
544
|
super().__init__(
|
545
545
|
attrs={
|
546
546
|
**(attrs or {}),
|
@@ -552,7 +552,7 @@ class UnfoldAdminIntegerFieldWidget(AdminIntegerFieldWidget):
|
|
552
552
|
|
553
553
|
|
554
554
|
class UnfoldAdminDecimalFieldWidget(AdminIntegerFieldWidget):
|
555
|
-
def __init__(self, attrs: Optional[
|
555
|
+
def __init__(self, attrs: Optional[dict[str, Any]] = None) -> None:
|
556
556
|
super().__init__(
|
557
557
|
attrs={
|
558
558
|
**(attrs or {}),
|
@@ -564,7 +564,7 @@ class UnfoldAdminDecimalFieldWidget(AdminIntegerFieldWidget):
|
|
564
564
|
|
565
565
|
|
566
566
|
class UnfoldAdminBigIntegerFieldWidget(AdminBigIntegerFieldWidget):
|
567
|
-
def __init__(self, attrs: Optional[
|
567
|
+
def __init__(self, attrs: Optional[dict[str, Any]] = None) -> None:
|
568
568
|
super().__init__(
|
569
569
|
attrs={
|
570
570
|
**(attrs or {}),
|
@@ -621,7 +621,7 @@ class UnfoldAdminRadioSelectWidget(AdminRadioSelect):
|
|
621
621
|
self.radio_style = radio_style
|
622
622
|
self.attrs["class"] = " ".join([*RADIO_CLASSES, self.attrs.get("class", "")])
|
623
623
|
|
624
|
-
def get_context(self, *args, **kwargs) ->
|
624
|
+
def get_context(self, *args, **kwargs) -> dict[str, Any]:
|
625
625
|
context = super().get_context(*args, **kwargs)
|
626
626
|
context.update({"radio_style": self.radio_style})
|
627
627
|
return context
|
@@ -666,7 +666,7 @@ except ImportError:
|
|
666
666
|
|
667
667
|
class UnfoldBooleanWidget(CheckboxInput):
|
668
668
|
def __init__(
|
669
|
-
self, attrs: Optional[
|
669
|
+
self, attrs: Optional[dict[str, Any]] = None, check_test: Callable = None
|
670
670
|
) -> None:
|
671
671
|
if attrs is None:
|
672
672
|
attrs = {}
|
@@ -684,7 +684,7 @@ class UnfoldBooleanWidget(CheckboxInput):
|
|
684
684
|
|
685
685
|
class UnfoldBooleanSwitchWidget(CheckboxInput):
|
686
686
|
def __init__(
|
687
|
-
self, attrs: Optional[
|
687
|
+
self, attrs: Optional[dict[str, Any]] = None, check_test: Callable = None
|
688
688
|
) -> None:
|
689
689
|
super().__init__(
|
690
690
|
attrs={
|
@@ -708,7 +708,7 @@ class UnfoldForeignKeyRawIdWidget(ForeignKeyRawIdWidget):
|
|
708
708
|
self,
|
709
709
|
rel: ForeignObjectRel,
|
710
710
|
admin_site: AdminSite,
|
711
|
-
attrs: Optional[
|
711
|
+
attrs: Optional[dict] = None,
|
712
712
|
using: Optional[Any] = None,
|
713
713
|
) -> None:
|
714
714
|
attrs = {
|
File without changes
|