django-unfold 0.64.2__py3-none-any.whl → 0.65.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.64.2.dist-info → django_unfold-0.65.0.dist-info}/METADATA +1 -1
- {django_unfold-0.64.2.dist-info → django_unfold-0.65.0.dist-info}/RECORD +18 -18
- unfold/admin.py +14 -15
- unfold/contrib/constance/templates/admin/constance/change_list.html +18 -18
- unfold/contrib/constance/templates/admin/constance/includes/results_list.html +13 -11
- unfold/dataclasses.py +1 -0
- unfold/mixins/base_model_admin.py +1 -1
- unfold/sites.py +2 -5
- unfold/static/unfold/css/styles.css +1 -1
- unfold/templates/admin/change_form.html +6 -2
- unfold/templates/unfold/helpers/header_back_button.html +1 -1
- unfold/templates/unfold/helpers/pagination_infinite.html +1 -1
- unfold/templates/unfold/helpers/site_dropdown.html +1 -1
- unfold/templatetags/unfold.py +28 -15
- unfold/views.py +2 -0
- unfold/widgets.py +2 -0
- {django_unfold-0.64.2.dist-info → django_unfold-0.65.0.dist-info}/LICENSE.md +0 -0
- {django_unfold-0.64.2.dist-info → django_unfold-0.65.0.dist-info}/WHEEL +0 -0
@@ -52,8 +52,12 @@
|
|
52
52
|
<input type="hidden" name="{{ to_field_var }}" value="{{ to_field }}">
|
53
53
|
{% endif %}
|
54
54
|
|
55
|
-
{%
|
56
|
-
|
55
|
+
{% if errors or adminform.form.non_field_errors %}
|
56
|
+
<div class="flex flex-col gap-4 *:mb-0">
|
57
|
+
{% include "unfold/helpers/messages/errornote.html" with errors=errors %}
|
58
|
+
{% include "unfold/helpers/messages/error.html" with errors=adminform.form.non_field_errors %}
|
59
|
+
</div>
|
60
|
+
{% endif %}
|
57
61
|
|
58
62
|
{% block field_sets %}
|
59
63
|
{% with has_conditional_display=adminform.model_admin.conditional_fields %}
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
{% if show_back_button %}
|
4
4
|
{% if object %}
|
5
|
-
{%
|
5
|
+
{% admin_object_app_url object "changelist" as changelist_url %}
|
6
6
|
|
7
7
|
<a href="{{ changelist_url }}" class="block h-[18px] mr-3" title="{% trans "Go back" %}">
|
8
8
|
<span class="material-symbols-outlined">
|
@@ -5,7 +5,7 @@
|
|
5
5
|
{% trans "Previous" %}
|
6
6
|
</a>
|
7
7
|
|
8
|
-
<a {% if cl.result_list|length %}href="{% infinite_paginator_url cl cl.page_num|add:1 %}"{% endif %} class="{% if cl.result_list|length %}hover:text-primary-600 dark:hover:text-primary-500{% endif %}">
|
8
|
+
<a {% if cl.result_list|length == cl.paginator.per_page %}href="{% infinite_paginator_url cl cl.page_num|add:1 %}"{% endif %} class="{% if cl.result_list|length and cl.result_list|length == cl.paginator.per_page %}hover:text-primary-600 dark:hover:text-primary-500{% endif %}">
|
9
9
|
{% trans "Next" %}
|
10
10
|
</a>
|
11
11
|
</div>
|
@@ -3,7 +3,7 @@
|
|
3
3
|
{% if site_dropdown %}
|
4
4
|
<div class="absolute bg-white border border-base-200 flex flex-col left-3 py-1 rounded-default shadow-lg top-[73px] w-[264px] z-50 dark:bg-base-800 dark:border-base-700" x-cloak x-show="openDropdown" x-transition x-on:click.outside="openDropdown = false">
|
5
5
|
{% for item in site_dropdown %}
|
6
|
-
<a href="{{ item.link }}" class="flex flex-row items-center gap-3 max-h-[30px] mx-1 px-2 py-2 rounded-default text-font-default-light dark:text-font-default-dark hover:bg-base-100 hover:text-font-important-light dark:hover:bg-base-700 dark:hover:text-font-important-dark">
|
6
|
+
<a href="{{ item.link }}" class="flex flex-row items-center gap-3 max-h-[30px] mx-1 px-2 py-2 rounded-default text-font-default-light dark:text-font-default-dark hover:bg-base-100 hover:text-font-important-light dark:hover:bg-base-700 dark:hover:text-font-important-dark" {% include "unfold/helpers/attrs.html" with attrs=item.attrs %}>
|
7
7
|
{% if item.icon %}
|
8
8
|
<span class="material-symbols-outlined">
|
9
9
|
{{ item.icon }}
|
unfold/templatetags/unfold.py
CHANGED
@@ -548,7 +548,7 @@ def changeform_data(adminform: AdminForm) -> str:
|
|
548
548
|
return mark_safe(json.dumps(fields))
|
549
549
|
|
550
550
|
|
551
|
-
@register.filter
|
551
|
+
@register.filter
|
552
552
|
def changeform_condition(field: BoundField) -> BoundField:
|
553
553
|
if isinstance(field.field, dict):
|
554
554
|
return field
|
@@ -611,11 +611,16 @@ def querystring_params(
|
|
611
611
|
def header_title(context: RequestContext) -> str:
|
612
612
|
parts = []
|
613
613
|
opts = context.get("opts")
|
614
|
+
current_app = (
|
615
|
+
context.request.current_app
|
616
|
+
if hasattr(context.request, "current_app")
|
617
|
+
else "admin"
|
618
|
+
)
|
614
619
|
|
615
620
|
if opts:
|
616
621
|
parts.append(
|
617
622
|
{
|
618
|
-
"link": reverse_lazy("
|
623
|
+
"link": reverse_lazy(f"{current_app}:app_list", args=[opts.app_label]),
|
619
624
|
"title": opts.app_config.verbose_name,
|
620
625
|
}
|
621
626
|
)
|
@@ -624,7 +629,7 @@ def header_title(context: RequestContext) -> str:
|
|
624
629
|
parts.append(
|
625
630
|
{
|
626
631
|
"link": reverse_lazy(
|
627
|
-
f"
|
632
|
+
f"{current_app}:{original._meta.app_label}_{original._meta.model_name}_changelist"
|
628
633
|
),
|
629
634
|
"title": original._meta.verbose_name_plural,
|
630
635
|
}
|
@@ -633,7 +638,7 @@ def header_title(context: RequestContext) -> str:
|
|
633
638
|
parts.append(
|
634
639
|
{
|
635
640
|
"link": reverse_lazy(
|
636
|
-
f"
|
641
|
+
f"{current_app}:{original._meta.app_label}_{original._meta.model_name}_change",
|
637
642
|
args=[original.pk],
|
638
643
|
),
|
639
644
|
"title": original,
|
@@ -643,7 +648,7 @@ def header_title(context: RequestContext) -> str:
|
|
643
648
|
parts.append(
|
644
649
|
{
|
645
650
|
"link": reverse_lazy(
|
646
|
-
f"
|
651
|
+
f"{current_app}:{object._meta.app_label}_{object._meta.model_name}_changelist"
|
647
652
|
),
|
648
653
|
"title": object._meta.verbose_name_plural,
|
649
654
|
}
|
@@ -652,7 +657,7 @@ def header_title(context: RequestContext) -> str:
|
|
652
657
|
parts.append(
|
653
658
|
{
|
654
659
|
"link": reverse_lazy(
|
655
|
-
f"
|
660
|
+
f"{current_app}:{object._meta.app_label}_{object._meta.model_name}_change",
|
656
661
|
args=[object.pk],
|
657
662
|
),
|
658
663
|
"title": object,
|
@@ -662,7 +667,7 @@ def header_title(context: RequestContext) -> str:
|
|
662
667
|
parts.append(
|
663
668
|
{
|
664
669
|
"link": reverse_lazy(
|
665
|
-
f"
|
670
|
+
f"{current_app}:{opts.app_label}_{opts.model_name}_changelist"
|
666
671
|
),
|
667
672
|
"title": opts.verbose_name_plural,
|
668
673
|
}
|
@@ -670,7 +675,9 @@ def header_title(context: RequestContext) -> str:
|
|
670
675
|
elif object := context.get("object"):
|
671
676
|
parts.append(
|
672
677
|
{
|
673
|
-
"link": reverse_lazy(
|
678
|
+
"link": reverse_lazy(
|
679
|
+
f"{current_app}:app_list", args=[object._meta.app_label]
|
680
|
+
),
|
674
681
|
"title": object._meta.app_label,
|
675
682
|
}
|
676
683
|
)
|
@@ -678,7 +685,7 @@ def header_title(context: RequestContext) -> str:
|
|
678
685
|
parts.append(
|
679
686
|
{
|
680
687
|
"link": reverse_lazy(
|
681
|
-
f"
|
688
|
+
f"{current_app}:{object._meta.app_label}_{object._meta.model_name}_changelist",
|
682
689
|
),
|
683
690
|
"title": object._meta.verbose_name_plural,
|
684
691
|
}
|
@@ -687,7 +694,7 @@ def header_title(context: RequestContext) -> str:
|
|
687
694
|
parts.append(
|
688
695
|
{
|
689
696
|
"link": reverse_lazy(
|
690
|
-
f"
|
697
|
+
f"{current_app}:{object._meta.app_label}_{object._meta.model_name}_change",
|
691
698
|
args=[object.pk],
|
692
699
|
),
|
693
700
|
"title": object,
|
@@ -697,7 +704,7 @@ def header_title(context: RequestContext) -> str:
|
|
697
704
|
parts.append(
|
698
705
|
{
|
699
706
|
"link": reverse_lazy(
|
700
|
-
"
|
707
|
+
f"{current_app}:app_list", args=[model_admin.model._meta.app_label]
|
701
708
|
),
|
702
709
|
"title": model_admin.model._meta.app_label,
|
703
710
|
}
|
@@ -706,7 +713,7 @@ def header_title(context: RequestContext) -> str:
|
|
706
713
|
parts.append(
|
707
714
|
{
|
708
715
|
"link": reverse_lazy(
|
709
|
-
f"
|
716
|
+
f"{current_app}:{model_admin.model._meta.app_label}_{model_admin.model._meta.model_name}_changelist",
|
710
717
|
),
|
711
718
|
"title": model_admin.model._meta.verbose_name_plural,
|
712
719
|
}
|
@@ -734,9 +741,15 @@ def header_title(context: RequestContext) -> str:
|
|
734
741
|
)
|
735
742
|
|
736
743
|
|
737
|
-
@register.
|
738
|
-
def admin_object_app_url(object: Model, arg: str) -> str:
|
739
|
-
|
744
|
+
@register.simple_tag(takes_context=True)
|
745
|
+
def admin_object_app_url(context: RequestContext, object: Model, arg: str) -> str:
|
746
|
+
current_app = (
|
747
|
+
context.request.current_app
|
748
|
+
if hasattr(context.request, "current_app")
|
749
|
+
else "admin"
|
750
|
+
)
|
751
|
+
|
752
|
+
return f"{current_app}:{object._meta.app_label}_{object._meta.model_name}_{arg}"
|
740
753
|
|
741
754
|
|
742
755
|
@register.filter
|
unfold/views.py
CHANGED
@@ -30,6 +30,8 @@ class UnfoldModelAdminViewMixin(PermissionRequiredMixin):
|
|
30
30
|
super().__init__(**kwargs)
|
31
31
|
|
32
32
|
def get_context_data(self, **kwargs: Any) -> dict[str, Any]:
|
33
|
+
self.request.current_app = self.model_admin.admin_site.name
|
34
|
+
|
33
35
|
if not hasattr(self, "model_admin"):
|
34
36
|
raise UnfoldException(
|
35
37
|
"UnfoldModelAdminViewMixin was not provided with 'model_admin' argument"
|
unfold/widgets.py
CHANGED
File without changes
|
File without changes
|