django-unfold 0.26.0__py3-none-any.whl → 0.28.0__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. {django_unfold-0.26.0.dist-info → django_unfold-0.28.0.dist-info}/METADATA +54 -5
  2. {django_unfold-0.26.0.dist-info → django_unfold-0.28.0.dist-info}/RECORD +33 -26
  3. unfold/admin.py +6 -157
  4. unfold/contrib/forms/templates/unfold/forms/array.html +31 -0
  5. unfold/contrib/forms/widgets.py +58 -3
  6. unfold/contrib/import_export/forms.py +21 -7
  7. unfold/contrib/import_export/templates/admin/import_export/change_list_export.html +5 -0
  8. unfold/contrib/import_export/templates/admin/import_export/export.html +1 -1
  9. unfold/dataclasses.py +2 -0
  10. unfold/decorators.py +3 -0
  11. unfold/fields.py +208 -0
  12. unfold/static/unfold/css/styles.css +1 -1
  13. unfold/templates/admin/change_form.html +0 -2
  14. unfold/templates/admin/edit_inline/tabular.html +4 -6
  15. unfold/templates/admin/includes/fieldset.html +2 -32
  16. unfold/templates/admin/login.html +4 -0
  17. unfold/templates/admin/submit_line.html +1 -1
  18. unfold/templates/unfold/helpers/attrs.html +1 -0
  19. unfold/templates/unfold/helpers/display_header.html +1 -1
  20. unfold/templates/unfold/helpers/field_readonly.html +1 -3
  21. unfold/templates/unfold/helpers/field_readonly_value.html +1 -0
  22. unfold/templates/unfold/helpers/fieldset_row.html +53 -0
  23. unfold/templates/unfold/helpers/search_results.html +10 -10
  24. unfold/templates/unfold/layouts/base.html +11 -0
  25. unfold/templates/unfold/layouts/base_simple.html +7 -1
  26. unfold/templates/unfold/widgets/clearable_file_input.html +1 -1
  27. unfold/templates/unfold/widgets/clearable_file_input_small.html +1 -1
  28. unfold/templates/unfold/widgets/foreign_key_raw_id.html +7 -13
  29. unfold/utils.py +21 -1
  30. unfold/views.py +18 -6
  31. unfold/widgets.py +12 -1
  32. {django_unfold-0.26.0.dist-info → django_unfold-0.28.0.dist-info}/LICENSE.md +0 -0
  33. {django_unfold-0.26.0.dist-info → django_unfold-0.28.0.dist-info}/WHEEL +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: django-unfold
3
- Version: 0.26.0
3
+ Version: 0.28.0
4
4
  Summary: Modern Django admin theme for seamless interface development
5
5
  Home-page: https://unfoldadmin.com
6
6
  License: MIT
@@ -35,13 +35,13 @@ Description-Content-Type: text/markdown
35
35
 
36
36
  Unfold is theme for Django admin incorporating most common practises for building full-fledged admin areas. It is designed to work at the top of default administration provided by Django.
37
37
 
38
- - **Unfold:** demo site is available at [unfoldadmin.com](https://unfoldadmin.com)
38
+ - **Unfold:** demo site is available at [unfoldadmin.com](https://unfoldadmin.com?utm_medium=github&utm_source=unfold)
39
39
  - **Formula:** repository with demo implementation at [github.com/unfoldadmin/formula](https://github.com/unfoldadmin/formula)
40
40
  - **Turbo:** Django & Next.js boilerplate implementing Unfold at [github.com/unfoldadmin/turbo](https://github.com/unfoldadmin/turbo)
41
41
 
42
42
  ## Are you using Unfold and need a help?<!-- omit from toc -->
43
43
 
44
- Did you decide to start using Unfold but you don't have time to make the switch from native Django admin? [Get in touch with us](https://unfoldadmin.com/) and let's supercharge development by using our know-how.
44
+ Did you decide to start using Unfold but you don't have time to make the switch from native Django admin? [Get in touch with us](https://unfoldadmin.com/?utm_medium=github&utm_source=unfold) and let's supercharge development by using our know-how.
45
45
 
46
46
  ## Features <!-- omit from toc -->
47
47
 
@@ -52,15 +52,17 @@ Did you decide to start using Unfold but you don't have time to make the switch
52
52
  - **Dependencies:** completely based only on `django.contrib.admin`
53
53
  - **Actions:** multiple ways how to define actions within different parts of admin
54
54
  - **WYSIWYG:** built-in support for WYSIWYG (Trix)
55
+ - **Array widget:** built-in widget for `django.contrib.postgres.fields.ArrayField`
55
56
  - **Filters:** custom dropdown, numeric, datetime, and text fields
56
57
  - **Dashboard:** custom components for rapid dashboard development
57
58
  - **Model tabs:** define custom tab navigations for models
58
59
  - **Fieldset tabs:** merge several fielsets into tabs in change form
59
60
  - **Colors:** possibility to override default color scheme
61
+ - **Changeform modes:** display fields in changeform in compressed mode
60
62
  - **Third party packages:** default support for multiple popular applications
61
63
  - **Environment label**: distinguish between environments by displaying a label
62
64
  - **Nonrelated inlines**: displays nonrelated model as inline in changeform
63
- - **Parallel admin**: support for default admin in parallel with Unfold. [Admin migration guide](https://unfoldadmin.com/blog/migrating-django-admin-unfold/)
65
+ - **Parallel admin**: support for default admin in parallel with Unfold. [Admin migration guide](https://unfoldadmin.com/blog/migrating-django-admin-unfold/?utm_medium=github&utm_source=unfold)
64
66
  - **VS Code**: project configuration and development container is included
65
67
 
66
68
  ## Table of contents <!-- omit from toc -->
@@ -79,6 +81,7 @@ Did you decide to start using Unfold but you don't have time to make the switch
79
81
  - [Dropdown filters](#dropdown-filters)
80
82
  - [Numeric filters](#numeric-filters)
81
83
  - [Date/time filters](#datetime-filters)
84
+ - [Custom admin pages](#custom-admin-pages)
82
85
  - [Nonrelated inlines](#nonrelated-inlines)
83
86
  - [Display decorator](#display-decorator)
84
87
  - [Change form tabs](#change-form-tabs)
@@ -321,13 +324,17 @@ def permission_callback(request):
321
324
 
322
325
  from django import models
323
326
  from django.contrib import admin
327
+ from django.contrib.postgres.fields import ArrayField
324
328
  from django.db import models
325
329
  from unfold.admin import ModelAdmin
326
- from unfold.contrib.forms.widgets import WysiwygWidget
330
+ from unfold.contrib.forms.widgets import ArrayWidget, WysiwygWidget
327
331
 
328
332
 
329
333
  @admin.register(MyModel)
330
334
  class CustomAdminClass(ModelAdmin):
335
+ # Display fields in changeform in compressed mode
336
+ compressed_fields = True # Default: False
337
+
331
338
  # Preprocess content of readonly fields before render
332
339
  readonly_preprocess_fields = {
333
340
  "model_field_name": "html.unescape",
@@ -346,6 +353,9 @@ class CustomAdminClass(ModelAdmin):
346
353
  formfield_overrides = {
347
354
  models.TextField: {
348
355
  "widget": WysiwygWidget,
356
+ },
357
+ ArrayField: {
358
+ "widget": ArrayWidget,
349
359
  }
350
360
  }
351
361
  ```
@@ -636,6 +646,45 @@ class YourModelAdmin(ModelAdmin):
636
646
  )
637
647
  ```
638
648
 
649
+ ## Custom admin pages
650
+
651
+ By default, Unfold provides a basic view mixin which helps with creation of basic views which are part of Unfold UI. The implementation requires creation of class based view inheriting from `unfold.views.UnfoldModelAdminViewMixin`. It is important to add `title` and `permissions_required` properties.
652
+
653
+ ```python
654
+ # admin.py
655
+
656
+ from django.views.generic import TemplateView
657
+ from unfold.admin import ModelAdmin
658
+ from unfold.views import UnfoldModelAdminViewMixin
659
+
660
+
661
+ class MyClassBasedView(UnfoldModelAdminViewMixin, TemplateView):
662
+ title = "Custom Title" # required: custom page header title
663
+ permissions_required = () # required: tuple of permissions
664
+ template_name = "some/template/path.html"
665
+
666
+
667
+ class CustomAdmin(ModelAdmin):
668
+ def get_urls(self):
669
+ return super().get_urls() + [
670
+ path(
671
+ "custom-url-path",
672
+ MyClassBasedView.as_view(model_admin=self), # IMPORTANT: model_admin is required
673
+ name="custom_name"
674
+ ),
675
+ ]
676
+ ```
677
+
678
+ The template is straightforward, extend from `unfold/layouts/base.html` and the UI will display all Unfold components like header or sidebar with all menu items. Then all content needs to be located in `content` block.
679
+
680
+ ```django-html
681
+ {% extends "unfold/layouts/base.html" %}
682
+
683
+ {% block content %}
684
+ Content here
685
+ {% endblock %}
686
+ ```
687
+
639
688
  ## Nonrelated inlines
640
689
 
641
690
  To display inlines which are not related (no foreign key pointing at the main model) to the model instance in changeform, you can use nonrelated inlines which are included in `unfold.contrib.inlines` module. Make sure this module is included in `INSTALLED_APPS` in settings.py.
@@ -1,5 +1,5 @@
1
1
  unfold/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- unfold/admin.py,sha256=ATDHEq87eC1zgtoObwqTCpRKqJbl0yrS0rf6AAHZTxM,24133
2
+ unfold/admin.py,sha256=Q8my6Ui10yDW_KqTwfPK8p51u9SAj2n5f8DFF8lxYuk,18991
3
3
  unfold/apps.py,sha256=SlBXPYrUd2uXn67qFbRvbXSUk3XFWrF4-5WELgDCvho,381
4
4
  unfold/checks.py,sha256=Smgji9w19hnYjJElJ_FJnnyTEAE-E-OUB6otHu7lasY,1670
5
5
  unfold/contrib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -23,9 +23,10 @@ unfold/contrib/forms/apps.py,sha256=Di0TMzVuRpVxLG-8Bjdq5ALCSf5r7u2xVhD0jU6H5Sc,
23
23
  unfold/contrib/forms/static/unfold/forms/css/trix.css,sha256=TH9WdnaZrmwI8hAEydwjobdrBzSw_KYdRTSQDuD-8hE,20027
24
24
  unfold/contrib/forms/static/unfold/forms/js/trix.config.js,sha256=spkNBlJVk_pqido_rM6yywQxkJ3Kqb7DMLiBgpKksdA,858
25
25
  unfold/contrib/forms/static/unfold/forms/js/trix.js,sha256=Pao0XiVeDiRawfTkGDg_np6CxB-oXPrUDI9akWc87oc,174157
26
+ unfold/contrib/forms/templates/unfold/forms/array.html,sha256=11silyHbsJA0U_ksS8MvfFOJKC_qKTAwXxoMIB78APk,1507
26
27
  unfold/contrib/forms/templates/unfold/forms/helpers/toolbar.html,sha256=yS8Zy-UrzvZ5RUYwdprQzREffnYq0NlIbXBfZM2UB04,9700
27
28
  unfold/contrib/forms/templates/unfold/forms/wysiwyg.html,sha256=4ZefV6XrjJlUczcuSw8BhvMJUFSZPSXo1IkgkBivh5g,351
28
- unfold/contrib/forms/widgets.py,sha256=_81_fsvK-yEsFIqLU59BTIIs2KAJk61pLs7J9sNi1G0,962
29
+ unfold/contrib/forms/widgets.py,sha256=yWug9YQ6FWI7hqvNZqhCwJhlfC_gMh9GELVGTE2Tw9k,2813
29
30
  unfold/contrib/guardian/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
30
31
  unfold/contrib/guardian/apps.py,sha256=ObJqwh4vHxkD4XfduP5IQAiYiWZxsXUOUqF1_R1GsRI,136
31
32
  unfold/contrib/guardian/templates/admin/guardian/model/change_form.html,sha256=FSJc4MYYWyzZAy8Ay0b7Ov-cUo-oELHOM5fQehM54Lg,403
@@ -37,13 +38,14 @@ unfold/contrib/guardian/templates/unfold/guardian/group_form.html,sha256=P8WMC5E
37
38
  unfold/contrib/guardian/templates/unfold/guardian/user_form.html,sha256=ci7FRrhTEKbFKKxsJ-07_dWXBYz4mqXPoqu5HfqYLaM,4132
38
39
  unfold/contrib/import_export/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
39
40
  unfold/contrib/import_export/apps.py,sha256=SdJu6Qh90VqGWY19FSDhhpUqhTbaIYsJKny3zX5baHI,149
40
- unfold/contrib/import_export/forms.py,sha256=cmUUiULJo771rbxf-uCarrbRNwvzCIketbP_7eFnvGc,1496
41
+ unfold/contrib/import_export/forms.py,sha256=O8BBKJIdqLg3-uUFQyDV9-L6EoJ7EVSX3LJBP1zegGw,2037
41
42
  unfold/contrib/import_export/templates/admin/import_export/base.html,sha256=loL2qcV-f8aAzkHss_I4IkwfgemVW2CjOu_aiBxdwX0,357
42
43
  unfold/contrib/import_export/templates/admin/import_export/change_form.html,sha256=_YorgltKO0CRSaLBAp67XnGMUBWEP_XewsUff0hlrE4,446
44
+ unfold/contrib/import_export/templates/admin/import_export/change_list_export.html,sha256=vZb2XVoJrDSjM1msiZqkQPMLQGjuqRHuLNdt11hmbQs,164
43
45
  unfold/contrib/import_export/templates/admin/import_export/change_list_export_item.html,sha256=pTDeqPKOlCPKH2dxMIfPnWuc2wVDzB7AzL73WbxSnRY,257
44
46
  unfold/contrib/import_export/templates/admin/import_export/change_list_import_export.html,sha256=JdKd6P2Ot9Ou4yg4CywTauuE1UiTz_mRvDwlx3vj3LI,229
45
47
  unfold/contrib/import_export/templates/admin/import_export/change_list_import_item.html,sha256=XUuRxnsx9YQbKvW-E_JGl_ha7kpTSGSoRefOTTizuX0,233
46
- unfold/contrib/import_export/templates/admin/import_export/export.html,sha256=a0gL1YvlFTYQEpJuab-Ue_YL86UO5VkfREqy5CepZUg,3481
48
+ unfold/contrib/import_export/templates/admin/import_export/export.html,sha256=NZ2bZ0yvskp_twIjX9LSROMmicXAU8dDXemxdII9_K0,3447
47
49
  unfold/contrib/import_export/templates/admin/import_export/import.html,sha256=P54_f3s96PV87Bo-FCZfmsn9DkRXLOB36r7HYF6y7GM,2075
48
50
  unfold/contrib/import_export/templates/admin/import_export/import_confirm.html,sha256=M-acK4XSLHuPFD_NJashGYvPPeJrJsC-3LMvHs3lRis,867
49
51
  unfold/contrib/import_export/templates/admin/import_export/import_errors.html,sha256=0DmJvZs31u-E2Y53yySci86cTnG9aUnOzvfYrOo0lYA,1422
@@ -62,14 +64,15 @@ unfold/contrib/simple_history/templates/simple_history/_object_history_list.html
62
64
  unfold/contrib/simple_history/templates/simple_history/object_history.html,sha256=AZ6uQRr7wKxV_rys5hGTVGYtVS-Fp5eHIqiXYW8FB1c,847
63
65
  unfold/contrib/simple_history/templates/simple_history/object_history_form.html,sha256=MOL3Tw3Nk3Rnq1koRV7yeCev4CP06_4xqAIOQk1M7FU,2290
64
66
  unfold/contrib/simple_history/templates/simple_history/submit_line.html,sha256=ns9CEkU4HwKHhhj8qj_9UXvzp0viGtD1tp93GV2WRCs,1703
65
- unfold/dataclasses.py,sha256=JJdGYzQ8MpeOe2FQPJqrMn_UJcxUz1VJgHCuCtkZCA8,199
66
- unfold/decorators.py,sha256=BVDlxhZxB4ND3f5-5oiENRTv_W_Q_Eu-gZlsrYKOxiU,3272
67
+ unfold/dataclasses.py,sha256=XssBT3nfeFO-oekKDWrX6abIyrIW1P8CPzzCv1TRYFM,266
68
+ unfold/decorators.py,sha256=6E4vPVwK0IQDAiDPg9pgyypRqciX_gR0jwITDcrSc8U,3367
67
69
  unfold/exceptions.py,sha256=gcCj1ox61E137bk_0Cqy4YC3SttdPgB-fiJUqpmyHSE,43
70
+ unfold/fields.py,sha256=Zegz_og7aHpdvUdFlUcIYVPB9TjPGjybhR2QNuq1b7A,7422
68
71
  unfold/forms.py,sha256=GXEm3CFwglyuEbGdVyEMJTB45Gs-_RvGGlXJEkPy2kw,3688
69
72
  unfold/settings.py,sha256=--TdTSWdOA8TQGW4-vjJkjy_zEyd_kZwBr3BIuQ8hzI,1208
70
73
  unfold/sites.py,sha256=Gy_i43j2nizW2g8-mas5icvtk-beKism_CznATW6Ia8,12586
71
74
  unfold/static/unfold/css/simplebar.css,sha256=5LLaEM11pKi6JFCOLt4XKuZxTpT9rpdq_tNlaQytFlU,4647
72
- unfold/static/unfold/css/styles.css,sha256=hlPYMtAEeIPl7yIFpqMR4DqJwz9K2RLhpbI4aSNq6mU,91675
75
+ unfold/static/unfold/css/styles.css,sha256=CU9SCfH3nREI3C6yP9DFAvvr_23lSg9H6rAwM0_w958,91898
73
76
  unfold/static/unfold/fonts/inter/Inter-Bold.woff2,sha256=O88EyjAeRPE_QEyKBKpK5wf2epUOEu8wwjj5bnhCZqE,46552
74
77
  unfold/static/unfold/fonts/inter/Inter-Medium.woff2,sha256=O88EyjAeRPE_QEyKBKpK5wf2epUOEu8wwjj5bnhCZqE,46552
75
78
  unfold/static/unfold/fonts/inter/Inter-Regular.woff2,sha256=O88EyjAeRPE_QEyKBKpK5wf2epUOEu8wwjj5bnhCZqE,46552
@@ -91,7 +94,7 @@ unfold/templates/admin/auth/user/add_form.html,sha256=iLig-vd2YExXsj0xGBwYhZ4kGU
91
94
  unfold/templates/admin/auth/user/change_password.html,sha256=-Wa9ml3yss-kDz0YQxCiwoxs91KQD8eetCt5l6xekWM,2892
92
95
  unfold/templates/admin/base.html,sha256=MGqtCcydXZPnp6dasaWktyd9D6rdUYX01rFGAv7Zkm4,2226
93
96
  unfold/templates/admin/base_site.html,sha256=3ckWrcAdd7Pw1hk6Zwyknab_Qb-rteV9-mXhMnfo6VI,361
94
- unfold/templates/admin/change_form.html,sha256=OvegZJTH4eGHXf5RJOHfy9tXKCtyml_Yl8pENb9kNq8,5431
97
+ unfold/templates/admin/change_form.html,sha256=s7iHvcH1coJQu7QaDk6vx_tvgxMG8SQWEy4J9bBllzY,5361
95
98
  unfold/templates/admin/change_form_object_tools.html,sha256=eyeH-i2HgEM0Yi-OJA2D1VnKJyC19A_my1IDGxxoP8Y,593
96
99
  unfold/templates/admin/change_list.html,sha256=18GDZswc1c0xtw2BcKti9SX95Ar9e1BX_HSY0K79g_8,5102
97
100
  unfold/templates/admin/change_list_object_tools.html,sha256=cmMiT2nT20Ph5yfpj9aHPr76Z-JP4aSXp0o-Rnad28s,147
@@ -100,17 +103,17 @@ unfold/templates/admin/date_hierarchy.html,sha256=BfUPbsLpHZVa40BHBahz1H9RSVuz36
100
103
  unfold/templates/admin/delete_confirmation.html,sha256=hpa2E14oZEXBBs6W1qdNQuF650TIO2Rhr52Q6UfwVeQ,5166
101
104
  unfold/templates/admin/delete_selected_confirmation.html,sha256=Foka2yvwAMEZre-Kh1KNadRzrCotdKM2U4e6AJQYZu8,4941
102
105
  unfold/templates/admin/edit_inline/stacked.html,sha256=HG-Dj42gcKNofHRVjg0ltIER2oJGYUd9GN_B7lDv7rQ,4580
103
- unfold/templates/admin/edit_inline/tabular.html,sha256=mVlQ5aJr6-GdHM2zaWVUKaa6gok3Vv3MAMQj0sIX-lQ,12976
106
+ unfold/templates/admin/edit_inline/tabular.html,sha256=aMy6kk3ZDBtgZFf1pO30vHWmONvCYor9yoiR9Day4xI,13042
104
107
  unfold/templates/admin/filter.html,sha256=dkrFkei-EAlldIU8DrgvSChzWQuUOu6-LS_qlZxdfFw,1708
105
- unfold/templates/admin/includes/fieldset.html,sha256=qVxXy7KRI8GC4bIBPO9hjQlMtDg83vhEZbmVXqdfrgg,2929
108
+ unfold/templates/admin/includes/fieldset.html,sha256=lMVwBifFWKvLvHqZ6yjP6Xf6BJFzi-EOf5JHIxEHmRI,888
106
109
  unfold/templates/admin/includes/object_delete_summary.html,sha256=Nv69SCzyJHFX14iJFfodxKM0IIpQegKZH0fvKB15QJI,468
107
110
  unfold/templates/admin/index.html,sha256=pkGdKWdD3zzOvkRdELvdb15sleSpfl4eHPA14PAh7z0,684
108
- unfold/templates/admin/login.html,sha256=WdOfFLofwBWj9VKCq1U22uLY19J2YQY6vRaE4OOSKfQ,3681
111
+ unfold/templates/admin/login.html,sha256=ePmGmS9MrqvR6_6hnRSYdW57XKmMIuVGTL9I6jCw9BM,3792
109
112
  unfold/templates/admin/nav_sidebar.html,sha256=63lUhsHfrjZowplnOEq4BkGD9jlX0bVQw5VrAMJqf5M,1178
110
113
  unfold/templates/admin/object_history.html,sha256=PsbhXFd_3SCB9YkSJeHESp2VqjNlHtUW26mRtaZ-MD0,5069
111
114
  unfold/templates/admin/pagination.html,sha256=KWTPV7_hVSZ1374a-pqHXhnOueNQKu1UnSUYirrWtCk,1173
112
115
  unfold/templates/admin/search_form.html,sha256=8fJlPYHQDCm4Je05wwdNJuJQR6ChLgghWmo-yHSybMs,1099
113
- unfold/templates/admin/submit_line.html,sha256=Oi7lUe2oh8O4--ZM0eQzVtZQnRKVeVXylc1ECGA7zKI,4247
116
+ unfold/templates/admin/submit_line.html,sha256=X7xg5vgWfHFWJOuXOLshma_LWWI0H9GHDmMYD1JqfI4,4353
114
117
  unfold/templates/auth/widgets/read_only_password_hash.html,sha256=Li9efo-3cFC5zj9im0SPfc62R4ZNVPQhs24H1U7xmD8,785
115
118
  unfold/templates/registration/logged_out.html,sha256=E7RHtB6AGQwgUIiV7dwJ1DbdfNvEhzJARONnB6jRLhQ,1028
116
119
  unfold/templates/registration/password_change_done.html,sha256=i1ZzfTwZHWNWoN9_xHZDdcgLdTOVbTFFD1HUSuG0LkY,1062
@@ -131,12 +134,15 @@ unfold/templates/unfold/helpers/actions_row.html,sha256=1xd39zx38NOoKuDuxAG7PHeu
131
134
  unfold/templates/unfold/helpers/add_link.html,sha256=mIgpKrwqBO1oJ4cwPQWSX1oUHBwHJmy5-2TxUHf-1bo,808
132
135
  unfold/templates/unfold/helpers/app_list.html,sha256=lFnW8p9DcZbI9t3_ee9JX9ERHA0NRL2V88zpzuG4jq8,4720
133
136
  unfold/templates/unfold/helpers/app_list_default.html,sha256=vZkw1F7oHOKReNkdHRYjhuNdA1nNdvSD4wbDmf0bnsM,4102
137
+ unfold/templates/unfold/helpers/attrs.html,sha256=Mwpj72kuwYj8hOT3J2T8qx6f1r_4xwwaS1slHA-82jI,166
134
138
  unfold/templates/unfold/helpers/boolean.html,sha256=p_WOlytoXvDwta76WgcV4JSWKpBgKf4amhqmHF798F8,564
135
139
  unfold/templates/unfold/helpers/breadcrumb_item.html,sha256=k_1j57UV0WtzFFlMKaewj4NLbR_DhXI6RzCHThblZLw,234
136
- unfold/templates/unfold/helpers/display_header.html,sha256=RR3HexzdO3YazPSJYfF9UfujCDiJ_EDrmnfxDFNLd7U,1160
140
+ unfold/templates/unfold/helpers/display_header.html,sha256=HiuaIJ6Y8DSM99OFypLO_2uQadZIw7tSg1aJJpFEXkM,1161
137
141
  unfold/templates/unfold/helpers/display_label.html,sha256=LS9DWzYjHkYLV27sZDwyXlg2sLJ0AlId9FbjnXpsbfg,317
138
142
  unfold/templates/unfold/helpers/field.html,sha256=Ds-zUHkdyxamfUCVNhxvtM0XoJg9OCA0QcsLbLWv4oo,882
139
- unfold/templates/unfold/helpers/field_readonly.html,sha256=v7-2oSSDgOsuYpP70y8DqdBqbRybubAfSDzstveoBuw,382
143
+ unfold/templates/unfold/helpers/field_readonly.html,sha256=O0gHEW46OWt1oUUk0lZiyR-mztWv_7IH6GpKRm2wUw4,235
144
+ unfold/templates/unfold/helpers/field_readonly_value.html,sha256=wdzHVKaI96S-S1MaV-odKXDdT_MRkfWMcXdUBhRlTDY,490
145
+ unfold/templates/unfold/helpers/fieldset_row.html,sha256=pcVBMudv1QDZp840S9a_8BuFb1DzUWBmsPUZI7lfgDo,2751
140
146
  unfold/templates/unfold/helpers/fieldsets_tabs.html,sha256=V3bgW75eozaBDty-xfciGafhCWq_Ba5HfQkk92yRc9A,1445
141
147
  unfold/templates/unfold/helpers/form_errors.html,sha256=EwerIJptSCWXvtAJ1IZKfEn98qlShBIGavsTThbklAs,266
142
148
  unfold/templates/unfold/helpers/form_label.html,sha256=SR4U6iK9w4oels6iGY_Da-yN4BbXQVN9zCDlBGGXcw8,310
@@ -152,7 +158,7 @@ unfold/templates/unfold/helpers/navigation.html,sha256=Nmgk6_690AeHgKE0-YS7tQYq2
152
158
  unfold/templates/unfold/helpers/pagination_current_item.html,sha256=4cZ2KLVcP0Y7xuGyXgexDQ07r94cgM5Gnmtv11dkRPQ,69
153
159
  unfold/templates/unfold/helpers/pagination_ellipsis.html,sha256=Ar9Ntf2I_79mIVW5Hadwkn1Kx1Lj3d8eIXNXI1IIBfg,56
154
160
  unfold/templates/unfold/helpers/search.html,sha256=T3JLlzEeHTEpX6qfjNQ0cQPW2rtVIOyE9quEyVHVXsA,1382
155
- unfold/templates/unfold/helpers/search_results.html,sha256=nv2HDqGvP9aAmQ35Fdq0oiZcDFTXgkLic1AVMLumyU8,725
161
+ unfold/templates/unfold/helpers/search_results.html,sha256=N5CNMJSF91jbJS6OQP0nANlnwVeS9UmnuOJ8QLitl2c,774
156
162
  unfold/templates/unfold/helpers/site_icon.html,sha256=RO-R5yRt6yOx41Z8dpDP4lzwMXFdz8Dp5j8vGUtHzh0,789
157
163
  unfold/templates/unfold/helpers/site_logo.html,sha256=05tqXzHy--pluceRQ2jDUZCFX9DjPHdBqGaieUv9sXk,424
158
164
  unfold/templates/unfold/helpers/submit.html,sha256=oSzq85LRLhdOlbFtFZFhYm6ucT95u6LunTeSTDClszQ,206
@@ -161,12 +167,13 @@ unfold/templates/unfold/helpers/tab_list.html,sha256=WMFSx0HEvylI_AOIPtFuWff1ePJ
161
167
  unfold/templates/unfold/helpers/theme_switch.html,sha256=skkl6fYUnYLM7fAPivHxWjnOnuQSKa-7aDxh7I8dGIg,2266
162
168
  unfold/templates/unfold/helpers/userlinks.html,sha256=qWjtBt9Q_tU8a874ii0Qqg8t_d-SSYBTB_3QZfNlx9g,634
163
169
  unfold/templates/unfold/helpers/welcomemsg.html,sha256=noRysgSENef4_53pXaTiBCy2or6lQm1ZtmCQVODAB1c,1120
164
- unfold/templates/unfold/layouts/base_simple.html,sha256=rki7n7QagHFAaCEn488pTOj9dpNL9AwwzKps8Ipiubk,993
170
+ unfold/templates/unfold/layouts/base.html,sha256=bAXZDbyiyxNiE-49mqr7pHUFhC2mHZQzIDUY-js_yZ0,379
171
+ unfold/templates/unfold/layouts/base_simple.html,sha256=T37-ncKZBLNnOlsUQq90rGl3sLdRjFaxWCPG399pkbE,1179
165
172
  unfold/templates/unfold/layouts/skeleton.html,sha256=iXrUiggVp36vmBIia5p32c-9Ruy0PxkFFQogDpvENbk,3419
166
- unfold/templates/unfold/widgets/clearable_file_input.html,sha256=vXsyP0-YD-z3z6VL4vXW9pJH9_-ZU9u-3AnmZkni-R4,1994
167
- unfold/templates/unfold/widgets/clearable_file_input_small.html,sha256=rqUnHF4jwL8_RySUuq2aXgj-0P_usgo1HeVT_IcfyFY,2531
173
+ unfold/templates/unfold/widgets/clearable_file_input.html,sha256=gAJsfyCnanOyeN4ypp1y7r76znvITV7FYTyWvPsmlDs,1882
174
+ unfold/templates/unfold/widgets/clearable_file_input_small.html,sha256=LPgiKuMAYPiEupFxdlwc1TozNRV1w9ekdRuv-5P4fgw,2531
168
175
  unfold/templates/unfold/widgets/date.html,sha256=WXo2LG1v_gBZBSg-zocj7oujMKI0MWLYCIFfB04HMLQ,122
169
- unfold/templates/unfold/widgets/foreign_key_raw_id.html,sha256=26UGK04ojS-ZsvhWpPIbr6VE9b91Q2sEhB7FBkMY1NI,917
176
+ unfold/templates/unfold/widgets/foreign_key_raw_id.html,sha256=BgXi4ziywtkWmZuUye5bbJ6yeEoHDJB_2lkwXX8hc6c,1026
170
177
  unfold/templates/unfold/widgets/radio.html,sha256=3WcmclQNg7R_pRjEHL1dHkGjAzWlWNYnhHkAirC4nuA,646
171
178
  unfold/templates/unfold/widgets/radio_option.html,sha256=IZgPx-aWKJuxrSalJ3K50RFd1vwSpb9Qk0yZwfV78_A,368
172
179
  unfold/templates/unfold/widgets/range.html,sha256=28FBtSUgUcG82vpk_I27Lbs5oWZOV_oMzVhx4wj3-Ik,262
@@ -181,10 +188,10 @@ unfold/templatetags/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSu
181
188
  unfold/templatetags/unfold.py,sha256=HFe0GrTD4va0lLzsZhxqjEOONmehqOWdf5vulkxgfGU,6302
182
189
  unfold/templatetags/unfold_list.py,sha256=5xAjQX0_JnVwDaj-wGkGqbjOAtp-a18koWIKj5VfBz0,13867
183
190
  unfold/typing.py,sha256=1P8PWM2oeaceUJtA5j071RbKEBpHYaux441u7Hd6wv4,643
184
- unfold/utils.py,sha256=5OIgDcwvIJQbwbnnqHx61cHh-2T1h184mTAuNq5WXLI,4088
185
- unfold/views.py,sha256=Ml3XlEoHLcbEWof59Dw8ihKBMcmp-gBAibThtBFj55A,708
186
- unfold/widgets.py,sha256=iiI73XznYH34LgXBHu1oVtYb76lLO3HiOD9blmm89rY,15236
187
- django_unfold-0.26.0.dist-info/LICENSE.md,sha256=Ltk_quRyyvV3J5v3brtOqmibeZSw2Hrb8bY1W3ya0Ik,1077
188
- django_unfold-0.26.0.dist-info/METADATA,sha256=UUv_H7BwNNquFABkpQ1PObEBBKknsGFxkyDnkk3l5oU,48746
189
- django_unfold-0.26.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
190
- django_unfold-0.26.0.dist-info/RECORD,,
191
+ unfold/utils.py,sha256=zZdJE4FmwRd7p5a7sJiAoZjBOJitXJduOq7BulyppWM,4803
192
+ unfold/views.py,sha256=hQCyeeMa9kcJV1IZeeYqj8PGW7J4QWME8n-5n0UGmiU,1003
193
+ unfold/widgets.py,sha256=w9BnJ6LYaFJJG7eJGJ-NKwqSHh6iUExN4P94WRvZO_c,15575
194
+ django_unfold-0.28.0.dist-info/LICENSE.md,sha256=Ltk_quRyyvV3J5v3brtOqmibeZSw2Hrb8bY1W3ya0Ik,1077
195
+ django_unfold-0.28.0.dist-info/METADATA,sha256=_i3r1OdWajR9BKmzMzYuPv91IyuKVKMvSTu6ufCwl8E,50658
196
+ django_unfold-0.28.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
197
+ django_unfold-0.28.0.dist-info/RECORD,,
unfold/admin.py CHANGED
@@ -7,50 +7,30 @@ from django.contrib.admin import ModelAdmin as BaseModelAdmin
7
7
  from django.contrib.admin import StackedInline as BaseStackedInline
8
8
  from django.contrib.admin import TabularInline as BaseTabularInline
9
9
  from django.contrib.admin import display, helpers
10
- from django.contrib.admin.utils import lookup_field
11
10
  from django.contrib.admin.widgets import RelatedFieldWidgetWrapper
12
- from django.core.exceptions import ObjectDoesNotExist
13
11
  from django.db import models
14
- from django.db.models import (
15
- BLANK_CHOICE_DASH,
16
- ForeignObjectRel,
17
- JSONField,
18
- ManyToManyRel,
19
- Model,
20
- OneToOneField,
21
- )
12
+ from django.db.models import BLANK_CHOICE_DASH, Model
22
13
  from django.db.models.fields import Field
23
14
  from django.db.models.fields.related import ForeignKey, ManyToManyField
24
15
  from django.forms import Form
25
16
  from django.forms.fields import TypedChoiceField
26
- from django.forms.models import (
27
- ModelChoiceField,
28
- ModelMultipleChoiceField,
29
- )
30
- from django.forms.utils import flatatt
17
+ from django.forms.models import ModelChoiceField, ModelMultipleChoiceField
31
18
  from django.forms.widgets import SelectMultiple
32
19
  from django.http import HttpRequest, HttpResponse
33
20
  from django.shortcuts import redirect
34
- from django.template.defaultfilters import linebreaksbr
35
21
  from django.template.response import TemplateResponse
36
22
  from django.urls import URLPattern, path, reverse
37
- from django.utils.html import conditional_escape, format_html
38
- from django.utils.module_loading import import_string
39
- from django.utils.safestring import SafeText, mark_safe
40
- from django.utils.text import capfirst
23
+ from django.utils.safestring import mark_safe
41
24
  from django.utils.translation import gettext_lazy as _
42
25
  from django.views import View
43
26
 
44
27
  from .checks import UnfoldModelAdminChecks
45
28
  from .dataclasses import UnfoldAction
46
29
  from .exceptions import UnfoldException
30
+ from .fields import UnfoldAdminField, UnfoldAdminReadonlyField
47
31
  from .forms import ActionForm
48
- from .settings import get_config
49
32
  from .typing import FieldsetsType
50
- from .utils import display_for_field
51
33
  from .widgets import (
52
- CHECKBOX_LABEL_CLASSES,
53
- LABEL_CLASSES,
54
34
  SELECT_CLASSES,
55
35
  UnfoldAdminBigIntegerFieldWidget,
56
36
  UnfoldAdminDecimalFieldWidget,
@@ -90,8 +70,6 @@ try:
90
70
  except ImportError:
91
71
  HAS_MONEY = False
92
72
 
93
- checkbox = UnfoldBooleanWidget({"class": "action-select"}, lambda value: False)
94
-
95
73
  FORMFIELD_OVERRIDES = {
96
74
  models.DateTimeField: {
97
75
  "form_class": forms.SplitDateTimeField,
@@ -141,140 +119,10 @@ FORMFIELD_OVERRIDES_INLINE.update(
141
119
  }
142
120
  )
143
121
 
144
-
145
- class UnfoldAdminField(helpers.AdminField):
146
- def label_tag(self) -> SafeText:
147
- classes = []
148
- if not self.field.field.widget.__class__.__name__.startswith(
149
- "Unfold"
150
- ) and not self.field.field.widget.template_name.startswith("unfold"):
151
- return super().label_tag()
152
-
153
- # TODO load config from current AdminSite (override Fieldline.__iter__ method)
154
- for lang, flag in get_config()["EXTENSIONS"]["modeltranslation"][
155
- "flags"
156
- ].items():
157
- if f"[{lang}]" in self.field.label:
158
- self.field.label = self.field.label.replace(f"[{lang}]", flag)
159
- break
160
-
161
- contents = conditional_escape(self.field.label)
162
-
163
- if self.is_checkbox:
164
- classes.append(" ".join(CHECKBOX_LABEL_CLASSES))
165
- else:
166
- classes.append(" ".join(LABEL_CLASSES))
167
-
168
- if self.field.field.required:
169
- classes.append("required")
170
-
171
- attrs = {"class": " ".join(classes)} if classes else {}
172
- required = mark_safe(' <span class="text-red-600">*</span>')
173
-
174
- return self.field.label_tag(
175
- contents=mark_safe(contents),
176
- attrs=attrs,
177
- label_suffix=required if self.field.field.required else "",
178
- )
179
-
122
+ checkbox = UnfoldBooleanWidget({"class": "action-select"}, lambda value: False)
180
123
 
181
124
  helpers.AdminField = UnfoldAdminField
182
125
 
183
-
184
- class UnfoldAdminReadonlyField(helpers.AdminReadonlyField):
185
- def label_tag(self) -> SafeText:
186
- if not isinstance(self.model_admin, ModelAdmin) and not isinstance(
187
- self.model_admin, ModelAdminMixin
188
- ):
189
- return super().label_tag()
190
-
191
- attrs = {
192
- "class": " ".join(LABEL_CLASSES + ["mb-2"]),
193
- }
194
-
195
- label = self.field["label"]
196
-
197
- return format_html(
198
- "<label{}>{}{}</label>",
199
- flatatt(attrs),
200
- capfirst(label),
201
- self.form.label_suffix,
202
- )
203
-
204
- def is_json(self) -> bool:
205
- field, obj, model_admin = (
206
- self.field["field"],
207
- self.form.instance,
208
- self.model_admin,
209
- )
210
-
211
- try:
212
- f, attr, value = lookup_field(field, obj, model_admin)
213
- except (AttributeError, ValueError, ObjectDoesNotExist):
214
- return False
215
-
216
- return isinstance(f, JSONField)
217
-
218
- def contents(self) -> str:
219
- contents = self._get_contents()
220
- contents = self._preprocess_field(contents)
221
- return contents
222
-
223
- def _get_contents(self) -> str:
224
- from django.contrib.admin.templatetags.admin_list import _boolean_icon
225
-
226
- field, obj, model_admin = (
227
- self.field["field"],
228
- self.form.instance,
229
- self.model_admin,
230
- )
231
- try:
232
- f, attr, value = lookup_field(field, obj, model_admin)
233
- except (AttributeError, ValueError, ObjectDoesNotExist):
234
- result_repr = self.empty_value_display
235
- else:
236
- if field in self.form.fields:
237
- widget = self.form[field].field.widget
238
- # This isn't elegant but suffices for contrib.auth's
239
- # ReadOnlyPasswordHashWidget.
240
- if getattr(widget, "read_only", False):
241
- return widget.render(field, value)
242
- if f is None:
243
- if getattr(attr, "boolean", False):
244
- result_repr = _boolean_icon(value)
245
- else:
246
- if hasattr(value, "__html__"):
247
- result_repr = value
248
- else:
249
- result_repr = linebreaksbr(value)
250
- else:
251
- if isinstance(f.remote_field, ManyToManyRel) and value is not None:
252
- result_repr = ", ".join(map(str, value.all()))
253
- elif (
254
- isinstance(f.remote_field, (ForeignObjectRel, OneToOneField))
255
- and value is not None
256
- ):
257
- result_repr = self.get_admin_url(f.remote_field, value)
258
- else:
259
- result_repr = display_for_field(value, f, self.empty_value_display)
260
- return conditional_escape(result_repr)
261
- result_repr = linebreaksbr(result_repr)
262
- return conditional_escape(result_repr)
263
-
264
- def _preprocess_field(self, contents: str) -> str:
265
- if (
266
- hasattr(self.model_admin, "readonly_preprocess_fields")
267
- and self.field["field"] in self.model_admin.readonly_preprocess_fields
268
- ):
269
- func = self.model_admin.readonly_preprocess_fields[self.field["field"]]
270
- if isinstance(func, str):
271
- contents = import_string(func)(contents)
272
- elif callable(func):
273
- contents = func(contents)
274
-
275
- return contents
276
-
277
-
278
126
  helpers.AdminReadonlyField = UnfoldAdminReadonlyField
279
127
 
280
128
 
@@ -616,6 +464,7 @@ class ModelAdmin(ModelAdminMixin, BaseModelAdmin):
616
464
  method=method,
617
465
  description=self._get_action_description(method, action),
618
466
  path=self._get_action_url(method, action),
467
+ attrs=method.attrs if hasattr(method, "attrs") else None,
619
468
  )
620
469
 
621
470
  @staticmethod
@@ -0,0 +1,31 @@
1
+ {% load i18n %}
2
+
3
+ <div class="flex flex-col gap-4" x-data="{items: []}">
4
+ {% for subwidget in widget.subwidgets %}
5
+ <div class="flex flex-row">
6
+ {% with widget=subwidget %}
7
+ {% include widget.template_name %}
8
+ {% endwith %}
9
+
10
+ <a x-on:click="$el.parentElement.remove()" class="bg-white border cursor-pointer flex items-center h-9.5 justify-center ml-2 rounded shadow-sm shrink-0 text-red-600 text-sm w-9.5 dark:bg-gray-900 dark:border-gray-700 dark:text-red-500">
11
+ <span class="material-symbols-outlined text-sm">delete</span>
12
+ </a>
13
+ </div>
14
+ {% endfor %}
15
+
16
+ <template x-for="(item, index) in items" :key="item.key">
17
+ <div class="flex flex-row">
18
+ {% include template.template_name with widget=template %}
19
+
20
+ <a x-on:click="items.splice(index, 1)" class="bg-white border cursor-pointer flex items-center h-9.5 justify-center ml-2 rounded shadow-sm shrink-0 text-red-600 text-sm w-9.5 dark:bg-gray-900 dark:border-gray-700 dark:text-red-500">
21
+ <span class="material-symbols-outlined text-sm">delete</span>
22
+ </a>
23
+ </div>
24
+ </template>
25
+
26
+ <div class="flex flex-row">
27
+ <div x-on:click="items.push({ key: new Date().getTime()})" class="bg-primary-600 border border-transparent cursor-pointer font-medium inline-block px-3 py-2 rounded-md text-sm text-white w-full lg:w-auto">
28
+ {% trans "Add new item" %}
29
+ </div>
30
+ </div>
31
+ </div>
@@ -1,7 +1,10 @@
1
- from typing import Any, Dict, Optional
1
+ from typing import Any, Dict, List, Optional, Union
2
2
 
3
- from django.forms import Widget
4
- from unfold.widgets import PROSE_CLASSES
3
+ from django.core.validators import EMPTY_VALUES
4
+ from django.forms import MultiWidget, Widget
5
+ from django.http import QueryDict
6
+ from django.utils.datastructures import MultiValueDict
7
+ from unfold.widgets import PROSE_CLASSES, UnfoldAdminTextInputWidget
5
8
 
6
9
  WYSIWYG_CLASSES = [
7
10
  *PROSE_CLASSES,
@@ -22,6 +25,58 @@ WYSIWYG_CLASSES = [
22
25
  ]
23
26
 
24
27
 
28
+ class ArrayWidget(MultiWidget):
29
+ template_name = "unfold/forms/array.html"
30
+ widget_class = UnfoldAdminTextInputWidget
31
+
32
+ def __init__(self, *args: Any, **kwargs: Any) -> None:
33
+ widgets = [self.widget_class]
34
+ super().__init__(widgets)
35
+
36
+ def get_context(self, name: str, value: str, attrs: Dict) -> Dict:
37
+ self._resolve_widgets(value)
38
+ context = super().get_context(name, value, attrs)
39
+ template_widget = UnfoldAdminTextInputWidget()
40
+ template_widget.name = name
41
+
42
+ context.update({"template": template_widget})
43
+ return context
44
+
45
+ def value_from_datadict(
46
+ self, data: QueryDict, files: MultiValueDict, name: str
47
+ ) -> List:
48
+ values = []
49
+
50
+ for item in data.getlist(name):
51
+ if item not in EMPTY_VALUES:
52
+ values.append(item)
53
+
54
+ return values
55
+
56
+ def value_omitted_from_data(
57
+ self, data: QueryDict, files: MultiValueDict, name: str
58
+ ) -> List:
59
+ return data.getlist(name) not in [[""], *EMPTY_VALUES]
60
+
61
+ def decompress(self, value: Union[str, List]) -> List:
62
+ if isinstance(value, List):
63
+ return value.split(",")
64
+
65
+ return []
66
+
67
+ def _resolve_widgets(self, value: Optional[Union[List, str]]) -> None:
68
+ if value is None:
69
+ value = []
70
+
71
+ elif isinstance(value, List):
72
+ self.widgets = [self.widget_class for item in value]
73
+ else:
74
+ self.widgets = [self.widget_class for item in value.split(",")]
75
+
76
+ self.widgets_names = ["" for i in range(len(self.widgets))]
77
+ self.widgets = [w() if isinstance(w, type) else w for w in self.widgets]
78
+
79
+
25
80
  class WysiwygWidget(Widget):
26
81
  template_name = "unfold/forms/wysiwyg.html"
27
82
 
@@ -15,23 +15,37 @@ class ImportForm(BaseImportForm):
15
15
  def __init__(self, *args, **kwargs):
16
16
  super().__init__(*args, **kwargs)
17
17
 
18
- self.fields["resource"].widget.attrs["class"] = " ".join(SELECT_CLASSES)
19
- self.fields["import_file"].widget = UnfoldAdminFileFieldWidget()
20
- self.fields["format"].widget.attrs["class"] = " ".join(SELECT_CLASSES)
18
+ self.fields["resource"].widget.attrs["class"] = " ".join(
19
+ [self.fields["resource"].widget.attrs.get("class", ""), *SELECT_CLASSES]
20
+ )
21
+ self.fields["import_file"].widget = UnfoldAdminFileFieldWidget(
22
+ attrs=self.fields["import_file"].widget.attrs
23
+ )
24
+ self.fields["format"].widget.attrs["class"] = " ".join(
25
+ [self.fields["format"].widget.attrs.get("class", ""), *SELECT_CLASSES]
26
+ )
21
27
 
22
28
 
23
29
  class ExportForm(BaseExportForm):
24
30
  def __init__(self, *args, **kwargs):
25
31
  super().__init__(*args, **kwargs)
26
- self.fields["resource"].widget.attrs["class"] = " ".join(SELECT_CLASSES)
27
- self.fields["format"].widget.attrs["class"] = " ".join(SELECT_CLASSES)
32
+ self.fields["resource"].widget.attrs["class"] = " ".join(
33
+ [self.fields["resource"].widget.attrs.get("class", ""), *SELECT_CLASSES]
34
+ )
35
+ self.fields["format"].widget.attrs["class"] = " ".join(
36
+ [self.fields["format"].widget.attrs.get("class", ""), *SELECT_CLASSES]
37
+ )
28
38
 
29
39
 
30
40
  class SelectableFieldsExportForm(BaseSelectableFieldsExportForm):
31
41
  def __init__(self, formats, resources, **kwargs):
32
42
  super().__init__(formats, resources, **kwargs)
33
- self.fields["resource"].widget.attrs["class"] = " ".join(SELECT_CLASSES)
34
- self.fields["format"].widget.attrs["class"] = " ".join(SELECT_CLASSES)
43
+ self.fields["resource"].widget.attrs["class"] = " ".join(
44
+ [self.fields["resource"].widget.attrs.get("class", ""), *SELECT_CLASSES]
45
+ )
46
+ self.fields["format"].widget.attrs["class"] = " ".join(
47
+ [self.fields["format"].widget.attrs.get("class", ""), *SELECT_CLASSES]
48
+ )
35
49
 
36
50
  for _key, field in self.fields.items():
37
51
  if isinstance(field, BooleanField):
@@ -0,0 +1,5 @@
1
+ {% extends "admin/import_export/change_list.html" %}
2
+
3
+ {% block actions-items %}
4
+ {% include "admin/import_export/change_list_export_item.html" %}
5
+ {% endblock %}