django-unfold 0.50.0__py3-none-any.whl → 0.51.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.50.0.dist-info → django_unfold-0.51.0.dist-info}/METADATA +2 -2
- {django_unfold-0.50.0.dist-info → django_unfold-0.51.0.dist-info}/RECORD +13 -12
- unfold/sections.py +82 -0
- unfold/static/unfold/css/styles.css +1 -1
- unfold/templates/admin/change_list_results.html +36 -6
- unfold/templates/admin/filter.html +1 -1
- unfold/templates/unfold/components/card.html +1 -1
- unfold/templates/unfold/components/table.html +42 -26
- unfold/templates/unfold/helpers/change_list_filter_actions.html +1 -1
- unfold/templatetags/unfold.py +11 -2
- unfold/templatetags/unfold_list.py +10 -10
- {django_unfold-0.50.0.dist-info → django_unfold-0.51.0.dist-info}/LICENSE.md +0 -0
- {django_unfold-0.50.0.dist-info → django_unfold-0.51.0.dist-info}/WHEEL +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: django-unfold
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.51.0
|
4
4
|
Summary: Modern Django admin theme for seamless interface development
|
5
5
|
License: MIT
|
6
6
|
Keywords: django,admin,tailwind,theme
|
@@ -17,7 +17,7 @@ Classifier: Programming Language :: Python :: 3.10
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.11
|
18
18
|
Classifier: Programming Language :: Python :: 3.12
|
19
19
|
Classifier: Programming Language :: Python :: 3.13
|
20
|
-
Requires-Dist: django (>=
|
20
|
+
Requires-Dist: django (>=4.2)
|
21
21
|
Project-URL: Homepage, https://unfoldadmin.com
|
22
22
|
Project-URL: Repository, https://github.com/unfoldadmin/django-unfold
|
23
23
|
Description-Content-Type: text/markdown
|
@@ -81,12 +81,13 @@ unfold/mixins/__init__.py,sha256=YlhoDs9Y_DXQ8Ejr3enxuHMS1-Ij9fwukxNwpeOS4Co,190
|
|
81
81
|
unfold/mixins/action_model_admin.py,sha256=BPajuTGf7zAaZOqIq4shX8VQ3NTxWQpedvG58fmCTjk,12036
|
82
82
|
unfold/mixins/base_model_admin.py,sha256=PR4eqU48yB4CNy9Bjd7fjxbOFiFpZM4etYmBOSaRX_M,4140
|
83
83
|
unfold/overrides.py,sha256=ERVY9boZiXgjDYcTEZcIp7KWoeBZ45VM_zN31yAOjyQ,2922
|
84
|
+
unfold/sections.py,sha256=Lcg3xCZ76fqjm4vD4x7YdE5VsbTKluL-sX5QTEBlHxA,2379
|
84
85
|
unfold/settings.py,sha256=3ICha2I0oSaHhajG8159nHdNTYJInBtRQq9VziWKYKs,2709
|
85
86
|
unfold/sites.py,sha256=Pl8voDdMH_9RV1n3XmSz84T6OE8yDUAqNwlr-kPH1n8,16179
|
86
87
|
unfold/static/admin/js/admin/RelatedObjectLookups.js,sha256=alI0-yq7YPDJJJn-yg1ce79-Cv88yQDUrfaGqFZnsaY,9048
|
87
88
|
unfold/static/admin/js/inlines.js,sha256=74QODSKEkpKse4bft4wIFZquROcr2-hVTt9CEWOIJak,15061
|
88
89
|
unfold/static/unfold/css/simplebar.css,sha256=5LLaEM11pKi6JFCOLt4XKuZxTpT9rpdq_tNlaQytFlU,4647
|
89
|
-
unfold/static/unfold/css/styles.css,sha256=
|
90
|
+
unfold/static/unfold/css/styles.css,sha256=iMPVdCjI66jaAgjmHRV6n0jV8ssKCYa-v72mfbRlmo0,159966
|
90
91
|
unfold/static/unfold/fonts/inter/Inter-Bold.woff2,sha256=-oiBJ7baAVtlVp8DUfO1w5GtkokElR8cIOn4RiqNleo,114840
|
91
92
|
unfold/static/unfold/fonts/inter/Inter-Medium.woff2,sha256=D_PpRhThST61VjFP0keubEqFp3g7TMhr5TmUDPg_Kkg,114348
|
92
93
|
unfold/static/unfold/fonts/inter/Inter-Regular.woff2,sha256=4G9rG8VTqupORmgCPtCrChRxKcMQf1Ebx9A9NhsK4IU,111268
|
@@ -116,13 +117,13 @@ unfold/templates/admin/change_form.html,sha256=LfeAeLYpJvNhOMJWQFeb9oSrAznlB4pnF
|
|
116
117
|
unfold/templates/admin/change_form_object_tools.html,sha256=eyeH-i2HgEM0Yi-OJA2D1VnKJyC19A_my1IDGxxoP8Y,593
|
117
118
|
unfold/templates/admin/change_list.html,sha256=AhGUdt-S3m30WhSraWnBdLwZQ1JU9yZeVDL0WDqCEMI,5164
|
118
119
|
unfold/templates/admin/change_list_object_tools.html,sha256=cmMiT2nT20Ph5yfpj9aHPr76Z-JP4aSXp0o-Rnad28s,147
|
119
|
-
unfold/templates/admin/change_list_results.html,sha256=
|
120
|
+
unfold/templates/admin/change_list_results.html,sha256=n64K5ocS62kujxzzkojzOx4jJuiYcO8r4mcJfcsCQAs,7931
|
120
121
|
unfold/templates/admin/date_hierarchy.html,sha256=Jl_Vk05fXvsSvod5Dw2p3KhpCQGjtSX1zqlNjjkBFR4,1411
|
121
122
|
unfold/templates/admin/delete_confirmation.html,sha256=yT_NHbFHZEjkSCaGVcM52GCG-FDmWiJdTFLbq9CBCx4,4619
|
122
123
|
unfold/templates/admin/delete_selected_confirmation.html,sha256=QR0JhrPR8YI8KpQnB3xyrKxaui-_pEQmfaMDbcXjjZ0,4391
|
123
124
|
unfold/templates/admin/edit_inline/stacked.html,sha256=-ASy7Jd0SwWBDxurucbus86YT2AokJEcCUrqPlHVDQA,7644
|
124
125
|
unfold/templates/admin/edit_inline/tabular.html,sha256=FBgzUb-U0cZCN28-cpHzRSyPE6bgseD_r3MY1AP0nGQ,2813
|
125
|
-
unfold/templates/admin/filter.html,sha256=
|
126
|
+
unfold/templates/admin/filter.html,sha256=0B_hpLybHw1wUPPCN3KJvoWrx03iFeqP8m1LRCjnLlQ,2012
|
126
127
|
unfold/templates/admin/includes/fieldset.html,sha256=gX-dc-jPLswk21XSKUXzAU8WFl3CFfeVrIAU2bviPyg,812
|
127
128
|
unfold/templates/admin/includes/object_delete_summary.html,sha256=FgwfapZCKWtnFtTHqh1MRuxxLot4bAw92WCcR_V8ImI,444
|
128
129
|
unfold/templates/admin/index.html,sha256=JnNDpNKqFKVKMQvpUQo6ddcFqGadK5g78pxpKAHLuMU,583
|
@@ -137,7 +138,7 @@ unfold/templates/registration/logged_out.html,sha256=GgLzqmOGpiw5FcA-Aw_T6YvhYHh
|
|
137
138
|
unfold/templates/registration/password_change_done.html,sha256=9HDpSraz3Kxdy0Fghbn-Lv0GAtpPgG6cuO7fvfMiYg8,1077
|
138
139
|
unfold/templates/registration/password_change_form.html,sha256=EgakVWzpQUEJKQS0AOfk8O_CY1bKbyWXSUuBaxtQEdU,2232
|
139
140
|
unfold/templates/unfold/components/button.html,sha256=TABo79ppuGlm2ENvRs6L3Vne8B5_9he_OhZTnPMiitQ,473
|
140
|
-
unfold/templates/unfold/components/card.html,sha256=
|
141
|
+
unfold/templates/unfold/components/card.html,sha256=FVLN7kQZqMd_uhEi1LpiN9FUxZCa4RgGHYGmofCtQro,1141
|
141
142
|
unfold/templates/unfold/components/chart/bar.html,sha256=nDdDCUXvFd793OpNgNPQo0vBmvYngMsQyPHVTf1vfOw,297
|
142
143
|
unfold/templates/unfold/components/chart/cohort.html,sha256=elZj9e9E9cfVey_9LSOaDoVSE3Wn3BagSrwIXRSFadM,2354
|
143
144
|
unfold/templates/unfold/components/chart/line.html,sha256=DHaZUFTlCs5cX7ioYdTzoN4ITHWNcEoNSUp7v3hlo_E,298
|
@@ -147,7 +148,7 @@ unfold/templates/unfold/components/icon.html,sha256=Qlhcf41FOwNVJ-nvA0RJ_Dn6JW6P
|
|
147
148
|
unfold/templates/unfold/components/navigation.html,sha256=NCPFXM1Q__2LoIyNNYbhhZZPtdw3eLvmc9vlhnm9mhg,887
|
148
149
|
unfold/templates/unfold/components/progress.html,sha256=BnH2uC_ZL5ITvMjHiHoM0gjtbRTLNU1-tFcfCuJO0BE,808
|
149
150
|
unfold/templates/unfold/components/separator.html,sha256=yvHywT_MFkx5dNC2K53OFHRGxLDsEjRpptujXyGeoTY,168
|
150
|
-
unfold/templates/unfold/components/table.html,sha256=
|
151
|
+
unfold/templates/unfold/components/table.html,sha256=awXLt0diLeUAk1akVvyXiNApExtENR-MP-lf4MQrWTs,3075
|
151
152
|
unfold/templates/unfold/components/text.html,sha256=-GjxvdiaBQIaNfPSzT6SSIwnc3R27FkSDQMoF3FDPso,102
|
152
153
|
unfold/templates/unfold/components/title.html,sha256=aMYSO30ybFYqPnqwlJVh2uNmcgnVrRycZkHTjJTjpX8,171
|
153
154
|
unfold/templates/unfold/components/tracker.html,sha256=-PvDHdAAB2G5mKXpQUtljWJYhhavsa1aEoBvLrCiCJo,284
|
@@ -161,7 +162,7 @@ unfold/templates/unfold/helpers/boolean.html,sha256=kcSZr3siQeBWIy_jsx1tFf4m6IB3
|
|
161
162
|
unfold/templates/unfold/helpers/breadcrumb_item.html,sha256=9T6ojN7LOXIlgwSwlIwHgy5U22eQYtarCqcmzsQIoPU,201
|
162
163
|
unfold/templates/unfold/helpers/change_list_actions.html,sha256=p1_vC2Q_Fb-gAHA8y1zzOXqqn5TPQMrQfE26PkOY_ok,656
|
163
164
|
unfold/templates/unfold/helpers/change_list_filter.html,sha256=0l-c4H2PcDkAuzI6asAJf2rBfYavYG62F9d7yWWdkSI,1852
|
164
|
-
unfold/templates/unfold/helpers/change_list_filter_actions.html,sha256=
|
165
|
+
unfold/templates/unfold/helpers/change_list_filter_actions.html,sha256=fTlM6jyS83FhGulFYuhFVLJOGHRJV3mFCWDQnp1kp0U,1760
|
165
166
|
unfold/templates/unfold/helpers/delete_submit_line.html,sha256=N1w_TDIDN7Spj5diuhRUVOVgz2TiSeHVK2QvBjTLv2w,665
|
166
167
|
unfold/templates/unfold/helpers/display_header.html,sha256=rhru2GSxR0mH8_FEQuQVIS8gGGjaiWMV9f2HCPGMsaQ,1698
|
167
168
|
unfold/templates/unfold/helpers/display_label.html,sha256=LS9DWzYjHkYLV27sZDwyXlg2sLJ0AlId9FbjnXpsbfg,317
|
@@ -232,13 +233,13 @@ unfold/templates/unfold/widgets/textarea_expandable.html,sha256=Pqi2udY0FWxVA-B1
|
|
232
233
|
unfold/templates/unfold/widgets/time.html,sha256=WXo2LG1v_gBZBSg-zocj7oujMKI0MWLYCIFfB04HMLQ,122
|
233
234
|
unfold/templates/unfold/widgets/url.html,sha256=IRLgW44VTKN7UrSWeywJwaxQhfG5jhhXuT-KTadKX58,304
|
234
235
|
unfold/templatetags/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
235
|
-
unfold/templatetags/unfold.py,sha256=
|
236
|
-
unfold/templatetags/unfold_list.py,sha256
|
236
|
+
unfold/templatetags/unfold.py,sha256=dx-_6ml3Lt6AGYdl4TnDFFssLrqK0LwlcrKERlfV_GI,14462
|
237
|
+
unfold/templatetags/unfold_list.py,sha256=DTPVSM2gD59-R4bk39VOEqtzctCB2vgxOINuzHzZIho,14108
|
237
238
|
unfold/typing.py,sha256=i7LM2LiwYTAjT5-OLDUPVn5b9X-DMmHnjlZG2toWwSE,692
|
238
239
|
unfold/utils.py,sha256=L0oC9-j1B__BZ21M7i6rTXNbzCQaZ4T0qHYQcNupk0A,5480
|
239
240
|
unfold/views.py,sha256=FuYnMrlg6SegLUDDN6An__yZj8rchD_iBK8myieYhkA,1492
|
240
241
|
unfold/widgets.py,sha256=esW1wxdbZwUhF31ensitBF8_6kVq_Gp0_iDgv6F5Rr0,20246
|
241
|
-
django_unfold-0.
|
242
|
-
django_unfold-0.
|
243
|
-
django_unfold-0.
|
244
|
-
django_unfold-0.
|
242
|
+
django_unfold-0.51.0.dist-info/LICENSE.md,sha256=Ltk_quRyyvV3J5v3brtOqmibeZSw2Hrb8bY1W3ya0Ik,1077
|
243
|
+
django_unfold-0.51.0.dist-info/METADATA,sha256=SsSBDtZp3pGZVgBR5aag-LRLeSrV4vmssqpekTiQ_ng,5929
|
244
|
+
django_unfold-0.51.0.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
245
|
+
django_unfold-0.51.0.dist-info/RECORD,,
|
unfold/sections.py
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
from django.contrib.admin.utils import label_for_field, lookup_field
|
2
|
+
from django.db.models import Model
|
3
|
+
from django.http import HttpRequest
|
4
|
+
from django.template.loader import render_to_string
|
5
|
+
|
6
|
+
from unfold.utils import display_for_field
|
7
|
+
|
8
|
+
|
9
|
+
class BaseSection:
|
10
|
+
def __init__(self, request: HttpRequest, instance: Model) -> None:
|
11
|
+
self.request = request
|
12
|
+
self.instance = instance
|
13
|
+
|
14
|
+
def render(self) -> str:
|
15
|
+
raise NotImplementedError(
|
16
|
+
"Section subclasses must implement the render method."
|
17
|
+
)
|
18
|
+
|
19
|
+
|
20
|
+
class TableSection(BaseSection):
|
21
|
+
fields = []
|
22
|
+
related_name = None
|
23
|
+
verbose_name = None
|
24
|
+
height = None
|
25
|
+
|
26
|
+
def render(self) -> str:
|
27
|
+
results = getattr(self.instance, self.related_name)
|
28
|
+
headers = []
|
29
|
+
rows = []
|
30
|
+
|
31
|
+
for field_name in self.fields:
|
32
|
+
if hasattr(self, field_name):
|
33
|
+
if hasattr(getattr(self, field_name), "short_description"):
|
34
|
+
headers.append(getattr(self, field_name).short_description)
|
35
|
+
else:
|
36
|
+
headers.append(field_name)
|
37
|
+
else:
|
38
|
+
headers.append(label_for_field(field_name, results.model))
|
39
|
+
|
40
|
+
for result in results.all():
|
41
|
+
row = []
|
42
|
+
|
43
|
+
for field_name in self.fields:
|
44
|
+
if hasattr(self, field_name):
|
45
|
+
row.append(getattr(self, field_name)(result))
|
46
|
+
else:
|
47
|
+
field, attr, value = lookup_field(field_name, result)
|
48
|
+
row.append(display_for_field(value, field, "-"))
|
49
|
+
|
50
|
+
rows.append(row)
|
51
|
+
|
52
|
+
context = {
|
53
|
+
"request": self.request,
|
54
|
+
"table": {
|
55
|
+
"headers": headers,
|
56
|
+
"rows": rows,
|
57
|
+
},
|
58
|
+
}
|
59
|
+
|
60
|
+
if hasattr(self, "verbose_name") and self.verbose_name:
|
61
|
+
context["title"] = self.verbose_name
|
62
|
+
|
63
|
+
if hasattr(self, "height") and self.height:
|
64
|
+
context["height"] = self.height
|
65
|
+
|
66
|
+
return render_to_string(
|
67
|
+
"unfold/components/table.html",
|
68
|
+
context=context,
|
69
|
+
)
|
70
|
+
|
71
|
+
|
72
|
+
class TemplateSection(BaseSection):
|
73
|
+
template_name = None
|
74
|
+
|
75
|
+
def render(self) -> str:
|
76
|
+
return render_to_string(
|
77
|
+
self.template_name,
|
78
|
+
context={
|
79
|
+
"request": self.request,
|
80
|
+
"instance": self.instance,
|
81
|
+
},
|
82
|
+
)
|