django-unfold 0.25.0__tar.gz → 0.27.0__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (203) hide show
  1. {django_unfold-0.25.0 → django_unfold-0.27.0}/PKG-INFO +61 -7
  2. {django_unfold-0.25.0 → django_unfold-0.27.0}/README.md +60 -6
  3. {django_unfold-0.25.0 → django_unfold-0.27.0}/pyproject.toml +1 -1
  4. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/admin.py +13 -157
  5. django_unfold-0.27.0/src/unfold/contrib/forms/templates/unfold/forms/array.html +31 -0
  6. django_unfold-0.27.0/src/unfold/contrib/forms/widgets.py +97 -0
  7. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/import_export/forms.py +17 -0
  8. django_unfold-0.27.0/src/unfold/contrib/import_export/templates/admin/import_export/change_form.html +10 -0
  9. django_unfold-0.27.0/src/unfold/contrib/import_export/templates/admin/import_export/export.html +82 -0
  10. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/import_export/templates/admin/import_export/import_form.html +8 -12
  11. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/import_export/templates/admin/import_export/resource_fields_list.html +1 -1
  12. django_unfold-0.27.0/src/unfold/contrib/inlines/admin.py +141 -0
  13. django_unfold-0.27.0/src/unfold/contrib/inlines/apps.py +6 -0
  14. django_unfold-0.27.0/src/unfold/contrib/inlines/checks.py +18 -0
  15. django_unfold-0.27.0/src/unfold/contrib/inlines/forms.py +43 -0
  16. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/decorators.py +3 -0
  17. django_unfold-0.27.0/src/unfold/fields.py +200 -0
  18. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/forms.py +6 -0
  19. django_unfold-0.27.0/src/unfold/static/unfold/css/simplebar.css +230 -0
  20. django_unfold-0.27.0/src/unfold/static/unfold/css/styles.css +1 -0
  21. django_unfold-0.27.0/src/unfold/static/unfold/js/simplebar.js +10 -0
  22. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/styles.css +9 -1
  23. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/admin/app_list.html +1 -1
  24. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/admin/change_form.html +11 -11
  25. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/admin/change_list_results.html +2 -2
  26. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/admin/edit_inline/stacked.html +6 -6
  27. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/admin/edit_inline/tabular.html +7 -9
  28. django_unfold-0.27.0/src/unfold/templates/admin/includes/fieldset.html +21 -0
  29. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/helpers/app_list.html +1 -1
  30. django_unfold-0.27.0/src/unfold/templates/unfold/helpers/display_header.html +23 -0
  31. django_unfold-0.27.0/src/unfold/templates/unfold/helpers/field.html +23 -0
  32. django_unfold-0.27.0/src/unfold/templates/unfold/helpers/field_readonly.html +7 -0
  33. django_unfold-0.27.0/src/unfold/templates/unfold/helpers/field_readonly_value.html +1 -0
  34. django_unfold-0.27.0/src/unfold/templates/unfold/helpers/fieldset_row.html +53 -0
  35. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/helpers/fieldsets_tabs.html +4 -4
  36. django_unfold-0.27.0/src/unfold/templates/unfold/helpers/form_label.html +7 -0
  37. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/layouts/skeleton.html +2 -0
  38. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/widgets/clearable_file_input.html +1 -1
  39. django_unfold-0.27.0/src/unfold/templates/unfold/widgets/foreign_key_raw_id.html +15 -0
  40. django_unfold-0.27.0/src/unfold/templates/unfold/widgets/textarea.html +1 -0
  41. django_unfold-0.27.0/src/unfold/templatetags/__init__.py +0 -0
  42. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/widgets.py +36 -3
  43. django_unfold-0.25.0/src/unfold/contrib/forms/widgets.py +0 -42
  44. django_unfold-0.25.0/src/unfold/contrib/import_export/admin.py +0 -37
  45. django_unfold-0.25.0/src/unfold/contrib/import_export/templates/admin/import_export/export.html +0 -47
  46. django_unfold-0.25.0/src/unfold/static/unfold/css/styles.css +0 -1
  47. django_unfold-0.25.0/src/unfold/templates/admin/includes/fieldset.html +0 -51
  48. django_unfold-0.25.0/src/unfold/templates/unfold/helpers/display_header.html +0 -20
  49. django_unfold-0.25.0/src/unfold/templates/unfold/helpers/field.html +0 -9
  50. django_unfold-0.25.0/src/unfold/templates/unfold/helpers/field_readonly.html +0 -9
  51. django_unfold-0.25.0/src/unfold/templates/unfold/helpers/form_label.html +0 -7
  52. {django_unfold-0.25.0 → django_unfold-0.27.0}/LICENSE.md +0 -0
  53. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/__init__.py +0 -0
  54. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/apps.py +0 -0
  55. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/checks.py +0 -0
  56. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/__init__.py +0 -0
  57. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/filters/__init__.py +0 -0
  58. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/filters/admin.py +0 -0
  59. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/filters/apps.py +0 -0
  60. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/filters/forms.py +0 -0
  61. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/filters/static/unfold/filters/css/nouislider.min.css +0 -0
  62. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/filters/static/unfold/filters/js/DateTimeShortcuts.js +0 -0
  63. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/filters/static/unfold/filters/js/admin-numeric-filter.js +0 -0
  64. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/filters/static/unfold/filters/js/nouislider.min.js +0 -0
  65. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/filters/static/unfold/filters/js/wNumb.min.js +0 -0
  66. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/filters/templates/unfold/filters/filters_date_range.html +0 -0
  67. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/filters/templates/unfold/filters/filters_datetime_range.html +0 -0
  68. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/filters/templates/unfold/filters/filters_field.html +0 -0
  69. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/filters/templates/unfold/filters/filters_numeric_range.html +0 -0
  70. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/filters/templates/unfold/filters/filters_numeric_single.html +0 -0
  71. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/filters/templates/unfold/filters/filters_numeric_slider.html +0 -0
  72. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/forms/__init__.py +0 -0
  73. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/forms/apps.py +0 -0
  74. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/forms/static/unfold/forms/css/trix.css +0 -0
  75. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/forms/static/unfold/forms/js/trix.config.js +0 -0
  76. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/forms/static/unfold/forms/js/trix.js +0 -0
  77. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/forms/templates/unfold/forms/helpers/toolbar.html +0 -0
  78. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/forms/templates/unfold/forms/wysiwyg.html +0 -0
  79. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/guardian/__init__.py +0 -0
  80. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/guardian/apps.py +0 -0
  81. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/guardian/templates/admin/guardian/model/change_form.html +0 -0
  82. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/guardian/templates/admin/guardian/model/field.html +0 -0
  83. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/guardian/templates/admin/guardian/model/obj_perms_manage.html +0 -0
  84. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/guardian/templates/admin/guardian/model/obj_perms_manage_group.html +0 -0
  85. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/guardian/templates/admin/guardian/model/obj_perms_manage_user.html +0 -0
  86. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/guardian/templates/unfold/guardian/group_form.html +0 -0
  87. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/guardian/templates/unfold/guardian/user_form.html +0 -0
  88. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/import_export/__init__.py +0 -0
  89. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/import_export/apps.py +0 -0
  90. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/import_export/templates/admin/import_export/base.html +0 -0
  91. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/import_export/templates/admin/import_export/change_list_export_item.html +0 -0
  92. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/import_export/templates/admin/import_export/change_list_import_export.html +0 -0
  93. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/import_export/templates/admin/import_export/change_list_import_item.html +0 -0
  94. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/import_export/templates/admin/import_export/import.html +0 -0
  95. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/import_export/templates/admin/import_export/import_confirm.html +0 -0
  96. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/import_export/templates/admin/import_export/import_errors.html +0 -0
  97. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/import_export/templates/admin/import_export/import_preview.html +0 -0
  98. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/import_export/templates/admin/import_export/import_validation.html +0 -0
  99. {django_unfold-0.25.0/src/unfold/contrib/simple_history → django_unfold-0.27.0/src/unfold/contrib/inlines}/__init__.py +0 -0
  100. {django_unfold-0.25.0/src/unfold/templatetags → django_unfold-0.27.0/src/unfold/contrib/simple_history}/__init__.py +0 -0
  101. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/simple_history/apps.py +0 -0
  102. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/simple_history/templates/simple_history/_object_history_list.html +0 -0
  103. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/simple_history/templates/simple_history/object_history.html +0 -0
  104. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/simple_history/templates/simple_history/object_history_form.html +0 -0
  105. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/contrib/simple_history/templates/simple_history/submit_line.html +0 -0
  106. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/dataclasses.py +0 -0
  107. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/exceptions.py +0 -0
  108. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/settings.py +0 -0
  109. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/sites.py +0 -0
  110. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/static/unfold/fonts/inter/Inter-Bold.woff2 +0 -0
  111. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/static/unfold/fonts/inter/Inter-Medium.woff2 +0 -0
  112. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/static/unfold/fonts/inter/Inter-Regular.woff2 +0 -0
  113. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/static/unfold/fonts/inter/Inter-SemiBold.woff2 +0 -0
  114. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/static/unfold/fonts/inter/styles.css +0 -0
  115. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/static/unfold/fonts/material-symbols/Material-Symbols-Outlined.woff2 +0 -0
  116. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/static/unfold/fonts/material-symbols/styles.css +0 -0
  117. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/static/unfold/js/alpine.js +0 -0
  118. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/static/unfold/js/alpine.persist.js +0 -0
  119. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/static/unfold/js/app.js +0 -0
  120. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/static/unfold/js/chart.js +0 -0
  121. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/static/unfold/js/htmx.js +0 -0
  122. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/admin/actions.html +0 -0
  123. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/admin/app_index.html +0 -0
  124. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/admin/auth/user/add_form.html +0 -0
  125. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/admin/auth/user/change_password.html +0 -0
  126. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/admin/base.html +0 -0
  127. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/admin/base_site.html +0 -0
  128. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/admin/change_form_object_tools.html +0 -0
  129. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/admin/change_list.html +0 -0
  130. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/admin/change_list_object_tools.html +0 -0
  131. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/admin/date_hierarchy.html +0 -0
  132. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/admin/delete_confirmation.html +0 -0
  133. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/admin/delete_selected_confirmation.html +0 -0
  134. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/admin/filter.html +0 -0
  135. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/admin/includes/object_delete_summary.html +0 -0
  136. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/admin/index.html +0 -0
  137. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/admin/login.html +0 -0
  138. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/admin/nav_sidebar.html +0 -0
  139. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/admin/object_history.html +0 -0
  140. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/admin/pagination.html +0 -0
  141. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/admin/search_form.html +0 -0
  142. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/admin/submit_line.html +0 -0
  143. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/auth/widgets/read_only_password_hash.html +0 -0
  144. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/registration/logged_out.html +0 -0
  145. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/registration/password_change_done.html +0 -0
  146. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/registration/password_change_form.html +0 -0
  147. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/change_list_filter.html +0 -0
  148. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/components/card.html +0 -0
  149. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/components/chart/bar.html +0 -0
  150. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/components/chart/line.html +0 -0
  151. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/components/container.html +0 -0
  152. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/components/flex.html +0 -0
  153. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/components/navigation.html +0 -0
  154. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/components/progress.html +0 -0
  155. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/components/separator.html +0 -0
  156. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/components/text.html +0 -0
  157. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/components/title.html +0 -0
  158. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/helpers/account_links.html +0 -0
  159. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/helpers/actions_row.html +0 -0
  160. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/helpers/add_link.html +0 -0
  161. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/helpers/app_list_default.html +0 -0
  162. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/helpers/boolean.html +0 -0
  163. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/helpers/breadcrumb_item.html +0 -0
  164. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/helpers/display_label.html +0 -0
  165. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/helpers/form_errors.html +0 -0
  166. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/helpers/header.html +0 -0
  167. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/helpers/help_text.html +0 -0
  168. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/helpers/history.html +0 -0
  169. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/helpers/label.html +0 -0
  170. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/helpers/messages/error.html +0 -0
  171. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/helpers/messages/errornote.html +0 -0
  172. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/helpers/messages/info.html +0 -0
  173. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/helpers/messages.html +0 -0
  174. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/helpers/navigation.html +0 -0
  175. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/helpers/pagination_current_item.html +0 -0
  176. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/helpers/pagination_ellipsis.html +0 -0
  177. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/helpers/search.html +0 -0
  178. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/helpers/search_results.html +0 -0
  179. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/helpers/site_icon.html +0 -0
  180. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/helpers/site_logo.html +0 -0
  181. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/helpers/submit.html +0 -0
  182. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/helpers/tab_action.html +0 -0
  183. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/helpers/tab_list.html +0 -0
  184. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/helpers/theme_switch.html +0 -0
  185. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/helpers/userlinks.html +0 -0
  186. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/helpers/welcomemsg.html +0 -0
  187. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/layouts/base_simple.html +0 -0
  188. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/widgets/clearable_file_input_small.html +0 -0
  189. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/widgets/date.html +0 -0
  190. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/widgets/radio.html +0 -0
  191. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/widgets/radio_option.html +0 -0
  192. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/widgets/range.html +0 -0
  193. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/widgets/related_widget_wrapper.html +0 -0
  194. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/widgets/split_datetime.html +0 -0
  195. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/widgets/split_datetime_vertical.html +0 -0
  196. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/widgets/split_money.html +0 -0
  197. /django_unfold-0.25.0/src/unfold/templates/unfold/widgets/textarea.html → /django_unfold-0.27.0/src/unfold/templates/unfold/widgets/textarea_expandable.html +0 -0
  198. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templates/unfold/widgets/time.html +0 -0
  199. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templatetags/unfold.py +0 -0
  200. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/templatetags/unfold_list.py +0 -0
  201. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/typing.py +0 -0
  202. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/utils.py +0 -0
  203. {django_unfold-0.25.0 → django_unfold-0.27.0}/src/unfold/views.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: django-unfold
3
- Version: 0.25.0
3
+ Version: 0.27.0
4
4
  Summary: Modern Django admin theme for seamless interface development
5
5
  Home-page: https://unfoldadmin.com
6
6
  License: MIT
@@ -30,7 +30,7 @@ Description-Content-Type: text/markdown
30
30
 
31
31
  [![Build](https://img.shields.io/github/actions/workflow/status/unfoldadmin/django-unfold/release.yml?style=for-the-badge)](https://github.com/unfoldadmin/django-unfold/actions?query=workflow%3Arelease)
32
32
  [![PyPI - Version](https://img.shields.io/pypi/v/django-unfold.svg?style=for-the-badge)](https://pypi.org/project/django-unfold/)
33
- ![Code Style - Black](https://img.shields.io/badge/code%20style-black-000000.svg?style=for-the-badge)
33
+ ![Code Style - Ruff](https://img.shields.io/badge/code%20style-ruff-30173D.svg?style=for-the-badge)
34
34
  ![Pre Commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white&style=for-the-badge)
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.
@@ -52,14 +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
- - **Parallel admin**: support for having default admin in parallel with Unfold. [Admin migration guide](https://unfoldadmin.com/blog/migrating-django-admin-unfold/)
64
+ - **Nonrelated inlines**: displays nonrelated model as inline in changeform
65
+ - **Parallel admin**: support for default admin in parallel with Unfold. [Admin migration guide](https://unfoldadmin.com/blog/migrating-django-admin-unfold/)
63
66
  - **VS Code**: project configuration and development container is included
64
67
 
65
68
  ## Table of contents <!-- omit from toc -->
@@ -78,6 +81,7 @@ Did you decide to start using Unfold but you don't have time to make the switch
78
81
  - [Dropdown filters](#dropdown-filters)
79
82
  - [Numeric filters](#numeric-filters)
80
83
  - [Date/time filters](#datetime-filters)
84
+ - [Nonrelated inlines](#nonrelated-inlines)
81
85
  - [Display decorator](#display-decorator)
82
86
  - [Change form tabs](#change-form-tabs)
83
87
  - [Third party packages](#third-party-packages)
@@ -114,6 +118,7 @@ INSTALLED_APPS = [
114
118
  "unfold", # before django.contrib.admin
115
119
  "unfold.contrib.filters", # optional, if special filters are needed
116
120
  "unfold.contrib.forms", # optional, if special form elements are needed
121
+ "unfold.contrib.inlines", # optional, if special inlines are needed
117
122
  "unfold.contrib.import_export", # optional, if django-import-export package is used
118
123
  "unfold.contrib.guardian", # optional, if django-guardian package is used
119
124
  "unfold.contrib.simple_history", # optional, if django-simple-history package is used
@@ -318,13 +323,17 @@ def permission_callback(request):
318
323
 
319
324
  from django import models
320
325
  from django.contrib import admin
326
+ from django.contrib.postgres.fields import ArrayField
321
327
  from django.db import models
322
328
  from unfold.admin import ModelAdmin
323
- from unfold.contrib.forms.widgets import WysiwygWidget
329
+ from unfold.contrib.forms.widgets import ArrayWidget, WysiwygWidget
324
330
 
325
331
 
326
332
  @admin.register(MyModel)
327
333
  class CustomAdminClass(ModelAdmin):
334
+ # Display fields in changeform in compressed mode
335
+ compressed_fields = True # Default: False
336
+
328
337
  # Preprocess content of readonly fields before render
329
338
  readonly_preprocess_fields = {
330
339
  "model_field_name": "html.unescape",
@@ -343,6 +352,9 @@ class CustomAdminClass(ModelAdmin):
343
352
  formfield_overrides = {
344
353
  models.TextField: {
345
354
  "widget": WysiwygWidget,
355
+ },
356
+ ArrayField: {
357
+ "widget": ArrayWidget,
346
358
  }
347
359
  }
348
360
  ```
@@ -633,6 +645,41 @@ class YourModelAdmin(ModelAdmin):
633
645
  )
634
646
  ```
635
647
 
648
+ ## Nonrelated inlines
649
+
650
+ 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.
651
+
652
+ ```python
653
+ from django.contrib.auth.models import User
654
+ from unfold.admin import ModelAdmin
655
+ from unfold.contrib.inlines.admin import NonrelatedTabularInline
656
+ from .models import OtherModel
657
+
658
+ class OtherNonrelatedInline(NonrelatedTabularInline): # NonrelatedStackedInline is available as well
659
+ model = OtherModel
660
+ fields = ["field1", "field2"] # Ignore property to display all fields
661
+
662
+ def get_form_queryset(self, obj):
663
+ """
664
+ Gets all nonrelated objects needed for inlines. Method must be implemented.
665
+ """
666
+ return self.model.objects.all()
667
+
668
+ def save_new_instance(self, parent, instance):
669
+ """
670
+ Extra save method which can for example update inline instances based on current
671
+ main model object. Method must be implemented.
672
+ """
673
+ pass
674
+
675
+
676
+ @admin.register(User)
677
+ class UserAdmin(ModelAdmin):
678
+ inlines = [OtherNonrelatedInline]
679
+ ```
680
+
681
+ **NOTE:** credit for this functionality goes to [django-nonrelated-inlines](https://github.com/bhomnick/django-nonrelated-inlines)
682
+
636
683
  ## Display decorator
637
684
 
638
685
  Unfold introduces it's own `unfold.decorators.display` decorator. By default it has exactly same behavior as native `django.contrib.admin.decorators.display` but it adds same customizations which helps to extends default logic.
@@ -697,12 +744,15 @@ class UserAdmin(ModelAdmin):
697
744
  """
698
745
  return [
699
746
  "First main heading",
700
- "Smaller additional description", # Use None in case you don't need it
701
- "AB", # Short text which will appear in front of
747
+ "Smaller additional description", # Use None in case you don't need it
748
+ "AB", # Short text which will appear in front of
702
749
  # Image instead of initials. Initials are ignored if image is available
703
750
  {
704
751
  "path": "some/path/picture.jpg,
705
752
  "squared": True, # Picture is displayed in square format, if empty circle
753
+ "borderless": True # Picture will be displayed without border
754
+ "width": 64, # Removes default width. Use together with height
755
+ "height": 48, # Removes default height. Use together with width
706
756
  }
707
757
  ]
708
758
  ```
@@ -822,15 +872,18 @@ Adding support for django-guardian is quote straightforward in Unfold, just add
822
872
 
823
873
  from unfold.admin import ModelAdmin
824
874
  from import_export.admin import ImportExportModelAdmin
825
- from unfold.contrib.import_export.forms import ExportForm, ImportForm
875
+ from unfold.contrib.import_export.forms import ExportForm, ImportForm, SelectableFieldsExportForm
826
876
 
827
877
  class ExampleAdmin(ModelAdmin, ImportExportModelAdmin):
828
878
  import_form_class = ImportForm
829
879
  export_form_class = ExportForm
880
+ # export_form_class = SelectableFieldsExportForm
830
881
  ```
831
882
 
832
883
  When implementing `import_export.admin.ExportActionModelAdmin` class in admin panel, import_export plugin adds its own implementation of action form which is not incorporating Unfold CSS classes. For this reason, `unfold.contrib.import_export.admin` contains class with the same name `ExportActionModelAdmin` which inherits behavior of parent form and adds appropriate CSS classes.
833
884
 
885
+ **Note:** This class has been removed and in new version (4.x) of django-import-export it is not needed.
886
+
834
887
  ```python
835
888
  admin.py
836
889
 
@@ -1135,6 +1188,7 @@ The container has already a node preinstalled so it is possible to compile a new
1135
1188
 
1136
1189
  ## Credits
1137
1190
 
1191
+ - [django-nonrelated-inlines](https://github.com/bhomnick/django-nonrelated-inlines) - Django admin inlines for unrelated models
1138
1192
  - [TailwindCSS](https://tailwindcss.com/) - CSS framework
1139
1193
  - [HTMX](https://htmx.org/) - AJAX communication with backend
1140
1194
  - [Material Icons](https://fonts.google.com/icons) - Icons from Google Fonts
@@ -6,7 +6,7 @@
6
6
 
7
7
  [![Build](https://img.shields.io/github/actions/workflow/status/unfoldadmin/django-unfold/release.yml?style=for-the-badge)](https://github.com/unfoldadmin/django-unfold/actions?query=workflow%3Arelease)
8
8
  [![PyPI - Version](https://img.shields.io/pypi/v/django-unfold.svg?style=for-the-badge)](https://pypi.org/project/django-unfold/)
9
- ![Code Style - Black](https://img.shields.io/badge/code%20style-black-000000.svg?style=for-the-badge)
9
+ ![Code Style - Ruff](https://img.shields.io/badge/code%20style-ruff-30173D.svg?style=for-the-badge)
10
10
  ![Pre Commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white&style=for-the-badge)
11
11
 
12
12
  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.
@@ -28,14 +28,17 @@ Did you decide to start using Unfold but you don't have time to make the switch
28
28
  - **Dependencies:** completely based only on `django.contrib.admin`
29
29
  - **Actions:** multiple ways how to define actions within different parts of admin
30
30
  - **WYSIWYG:** built-in support for WYSIWYG (Trix)
31
+ - **Array widget:** built-in widget for `django.contrib.postgres.fields.ArrayField`
31
32
  - **Filters:** custom dropdown, numeric, datetime, and text fields
32
33
  - **Dashboard:** custom components for rapid dashboard development
33
34
  - **Model tabs:** define custom tab navigations for models
34
35
  - **Fieldset tabs:** merge several fielsets into tabs in change form
35
36
  - **Colors:** possibility to override default color scheme
37
+ - **Changeform modes:** display fields in changeform in compressed mode
36
38
  - **Third party packages:** default support for multiple popular applications
37
39
  - **Environment label**: distinguish between environments by displaying a label
38
- - **Parallel admin**: support for having default admin in parallel with Unfold. [Admin migration guide](https://unfoldadmin.com/blog/migrating-django-admin-unfold/)
40
+ - **Nonrelated inlines**: displays nonrelated model as inline in changeform
41
+ - **Parallel admin**: support for default admin in parallel with Unfold. [Admin migration guide](https://unfoldadmin.com/blog/migrating-django-admin-unfold/)
39
42
  - **VS Code**: project configuration and development container is included
40
43
 
41
44
  ## Table of contents <!-- omit from toc -->
@@ -54,6 +57,7 @@ Did you decide to start using Unfold but you don't have time to make the switch
54
57
  - [Dropdown filters](#dropdown-filters)
55
58
  - [Numeric filters](#numeric-filters)
56
59
  - [Date/time filters](#datetime-filters)
60
+ - [Nonrelated inlines](#nonrelated-inlines)
57
61
  - [Display decorator](#display-decorator)
58
62
  - [Change form tabs](#change-form-tabs)
59
63
  - [Third party packages](#third-party-packages)
@@ -90,6 +94,7 @@ INSTALLED_APPS = [
90
94
  "unfold", # before django.contrib.admin
91
95
  "unfold.contrib.filters", # optional, if special filters are needed
92
96
  "unfold.contrib.forms", # optional, if special form elements are needed
97
+ "unfold.contrib.inlines", # optional, if special inlines are needed
93
98
  "unfold.contrib.import_export", # optional, if django-import-export package is used
94
99
  "unfold.contrib.guardian", # optional, if django-guardian package is used
95
100
  "unfold.contrib.simple_history", # optional, if django-simple-history package is used
@@ -294,13 +299,17 @@ def permission_callback(request):
294
299
 
295
300
  from django import models
296
301
  from django.contrib import admin
302
+ from django.contrib.postgres.fields import ArrayField
297
303
  from django.db import models
298
304
  from unfold.admin import ModelAdmin
299
- from unfold.contrib.forms.widgets import WysiwygWidget
305
+ from unfold.contrib.forms.widgets import ArrayWidget, WysiwygWidget
300
306
 
301
307
 
302
308
  @admin.register(MyModel)
303
309
  class CustomAdminClass(ModelAdmin):
310
+ # Display fields in changeform in compressed mode
311
+ compressed_fields = True # Default: False
312
+
304
313
  # Preprocess content of readonly fields before render
305
314
  readonly_preprocess_fields = {
306
315
  "model_field_name": "html.unescape",
@@ -319,6 +328,9 @@ class CustomAdminClass(ModelAdmin):
319
328
  formfield_overrides = {
320
329
  models.TextField: {
321
330
  "widget": WysiwygWidget,
331
+ },
332
+ ArrayField: {
333
+ "widget": ArrayWidget,
322
334
  }
323
335
  }
324
336
  ```
@@ -609,6 +621,41 @@ class YourModelAdmin(ModelAdmin):
609
621
  )
610
622
  ```
611
623
 
624
+ ## Nonrelated inlines
625
+
626
+ 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.
627
+
628
+ ```python
629
+ from django.contrib.auth.models import User
630
+ from unfold.admin import ModelAdmin
631
+ from unfold.contrib.inlines.admin import NonrelatedTabularInline
632
+ from .models import OtherModel
633
+
634
+ class OtherNonrelatedInline(NonrelatedTabularInline): # NonrelatedStackedInline is available as well
635
+ model = OtherModel
636
+ fields = ["field1", "field2"] # Ignore property to display all fields
637
+
638
+ def get_form_queryset(self, obj):
639
+ """
640
+ Gets all nonrelated objects needed for inlines. Method must be implemented.
641
+ """
642
+ return self.model.objects.all()
643
+
644
+ def save_new_instance(self, parent, instance):
645
+ """
646
+ Extra save method which can for example update inline instances based on current
647
+ main model object. Method must be implemented.
648
+ """
649
+ pass
650
+
651
+
652
+ @admin.register(User)
653
+ class UserAdmin(ModelAdmin):
654
+ inlines = [OtherNonrelatedInline]
655
+ ```
656
+
657
+ **NOTE:** credit for this functionality goes to [django-nonrelated-inlines](https://github.com/bhomnick/django-nonrelated-inlines)
658
+
612
659
  ## Display decorator
613
660
 
614
661
  Unfold introduces it's own `unfold.decorators.display` decorator. By default it has exactly same behavior as native `django.contrib.admin.decorators.display` but it adds same customizations which helps to extends default logic.
@@ -673,12 +720,15 @@ class UserAdmin(ModelAdmin):
673
720
  """
674
721
  return [
675
722
  "First main heading",
676
- "Smaller additional description", # Use None in case you don't need it
677
- "AB", # Short text which will appear in front of
723
+ "Smaller additional description", # Use None in case you don't need it
724
+ "AB", # Short text which will appear in front of
678
725
  # Image instead of initials. Initials are ignored if image is available
679
726
  {
680
727
  "path": "some/path/picture.jpg,
681
728
  "squared": True, # Picture is displayed in square format, if empty circle
729
+ "borderless": True # Picture will be displayed without border
730
+ "width": 64, # Removes default width. Use together with height
731
+ "height": 48, # Removes default height. Use together with width
682
732
  }
683
733
  ]
684
734
  ```
@@ -798,15 +848,18 @@ Adding support for django-guardian is quote straightforward in Unfold, just add
798
848
 
799
849
  from unfold.admin import ModelAdmin
800
850
  from import_export.admin import ImportExportModelAdmin
801
- from unfold.contrib.import_export.forms import ExportForm, ImportForm
851
+ from unfold.contrib.import_export.forms import ExportForm, ImportForm, SelectableFieldsExportForm
802
852
 
803
853
  class ExampleAdmin(ModelAdmin, ImportExportModelAdmin):
804
854
  import_form_class = ImportForm
805
855
  export_form_class = ExportForm
856
+ # export_form_class = SelectableFieldsExportForm
806
857
  ```
807
858
 
808
859
  When implementing `import_export.admin.ExportActionModelAdmin` class in admin panel, import_export plugin adds its own implementation of action form which is not incorporating Unfold CSS classes. For this reason, `unfold.contrib.import_export.admin` contains class with the same name `ExportActionModelAdmin` which inherits behavior of parent form and adds appropriate CSS classes.
809
860
 
861
+ **Note:** This class has been removed and in new version (4.x) of django-import-export it is not needed.
862
+
810
863
  ```python
811
864
  admin.py
812
865
 
@@ -1111,6 +1164,7 @@ The container has already a node preinstalled so it is possible to compile a new
1111
1164
 
1112
1165
  ## Credits
1113
1166
 
1167
+ - [django-nonrelated-inlines](https://github.com/bhomnick/django-nonrelated-inlines) - Django admin inlines for unrelated models
1114
1168
  - [TailwindCSS](https://tailwindcss.com/) - CSS framework
1115
1169
  - [HTMX](https://htmx.org/) - AJAX communication with backend
1116
1170
  - [Material Icons](https://fonts.google.com/icons) - Icons from Google Fonts
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "django-unfold"
3
- version = "0.25.0"
3
+ version = "0.27.0"
4
4
  description = "Modern Django admin theme for seamless interface development"
5
5
  license = "MIT"
6
6
  readme = "README.md"
@@ -7,54 +7,35 @@ 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,
57
37
  UnfoldAdminEmailInputWidget,
38
+ UnfoldAdminFileFieldWidget,
58
39
  UnfoldAdminImageFieldWidget,
59
40
  UnfoldAdminImageSmallFieldWidget,
60
41
  UnfoldAdminIntegerFieldWidget,
@@ -71,6 +52,7 @@ from .widgets import (
71
52
  UnfoldAdminUUIDInputWidget,
72
53
  UnfoldBooleanSwitchWidget,
73
54
  UnfoldBooleanWidget,
55
+ UnfoldForeignKeyRawIdWidget,
74
56
  )
75
57
 
76
58
  try:
@@ -88,8 +70,6 @@ try:
88
70
  except ImportError:
89
71
  HAS_MONEY = False
90
72
 
91
- checkbox = UnfoldBooleanWidget({"class": "action-select"}, lambda value: False)
92
-
93
73
  FORMFIELD_OVERRIDES = {
94
74
  models.DateTimeField: {
95
75
  "form_class": forms.SplitDateTimeField,
@@ -109,6 +89,7 @@ FORMFIELD_OVERRIDES = {
109
89
  models.BigIntegerField: {"widget": UnfoldAdminBigIntegerFieldWidget},
110
90
  models.DecimalField: {"widget": UnfoldAdminDecimalFieldWidget},
111
91
  models.FloatField: {"widget": UnfoldAdminDecimalFieldWidget},
92
+ models.FileField: {"widget": UnfoldAdminFileFieldWidget},
112
93
  models.ImageField: {"widget": UnfoldAdminImageFieldWidget},
113
94
  models.JSONField: {"widget": UnfoldAdminTextareaWidget},
114
95
  models.DurationField: {"widget": UnfoldAdminTextInputWidget},
@@ -138,139 +119,10 @@ FORMFIELD_OVERRIDES_INLINE.update(
138
119
  }
139
120
  )
140
121
 
141
-
142
- class UnfoldAdminField(helpers.AdminField):
143
- def label_tag(self) -> SafeText:
144
- classes = []
145
-
146
- if not self.field.field.widget.__class__.__name__.startswith(
147
- "Unfold"
148
- ) and not self.field.field.widget.template_name.startswith("unfold"):
149
- return super().label_tag()
150
-
151
- # TODO load config from current AdminSite (override Fieldline.__iter__ method)
152
- for lang, flag in get_config()["EXTENSIONS"]["modeltranslation"][
153
- "flags"
154
- ].items():
155
- if f"[{lang}]" in self.field.label:
156
- self.field.label = self.field.label.replace(f"[{lang}]", flag)
157
- break
158
-
159
- contents = conditional_escape(self.field.label)
160
-
161
- if self.is_checkbox:
162
- classes.append(" ".join(CHECKBOX_LABEL_CLASSES))
163
- else:
164
- classes.append(" ".join(LABEL_CLASSES))
165
-
166
- if self.field.field.required:
167
- classes.append("required")
168
-
169
- attrs = {"class": " ".join(classes)} if classes else {}
170
- required = mark_safe(' <span class="text-red-600">*</span>')
171
-
172
- return self.field.label_tag(
173
- contents=mark_safe(contents),
174
- attrs=attrs,
175
- label_suffix=required if self.field.field.required else "",
176
- )
177
-
122
+ checkbox = UnfoldBooleanWidget({"class": "action-select"}, lambda value: False)
178
123
 
179
124
  helpers.AdminField = UnfoldAdminField
180
125
 
181
-
182
- class UnfoldAdminReadonlyField(helpers.AdminReadonlyField):
183
- def label_tag(self) -> SafeText:
184
- if not isinstance(self.model_admin, ModelAdmin):
185
- return super().label_tag()
186
-
187
- attrs = {
188
- "class": " ".join(LABEL_CLASSES + ["mb-2"]),
189
- }
190
-
191
- label = self.field["label"]
192
-
193
- return format_html(
194
- "<label{}>{}{}</label>",
195
- flatatt(attrs),
196
- capfirst(label),
197
- self.form.label_suffix,
198
- )
199
-
200
- def is_json(self) -> bool:
201
- field, obj, model_admin = (
202
- self.field["field"],
203
- self.form.instance,
204
- self.model_admin,
205
- )
206
-
207
- try:
208
- f, attr, value = lookup_field(field, obj, model_admin)
209
- except (AttributeError, ValueError, ObjectDoesNotExist):
210
- return False
211
-
212
- return isinstance(f, JSONField)
213
-
214
- def contents(self) -> str:
215
- contents = self._get_contents()
216
- contents = self._preprocess_field(contents)
217
- return contents
218
-
219
- def _get_contents(self) -> str:
220
- from django.contrib.admin.templatetags.admin_list import _boolean_icon
221
-
222
- field, obj, model_admin = (
223
- self.field["field"],
224
- self.form.instance,
225
- self.model_admin,
226
- )
227
- try:
228
- f, attr, value = lookup_field(field, obj, model_admin)
229
- except (AttributeError, ValueError, ObjectDoesNotExist):
230
- result_repr = self.empty_value_display
231
- else:
232
- if field in self.form.fields:
233
- widget = self.form[field].field.widget
234
- # This isn't elegant but suffices for contrib.auth's
235
- # ReadOnlyPasswordHashWidget.
236
- if getattr(widget, "read_only", False):
237
- return widget.render(field, value)
238
- if f is None:
239
- if getattr(attr, "boolean", False):
240
- result_repr = _boolean_icon(value)
241
- else:
242
- if hasattr(value, "__html__"):
243
- result_repr = value
244
- else:
245
- result_repr = linebreaksbr(value)
246
- else:
247
- if isinstance(f.remote_field, ManyToManyRel) and value is not None:
248
- result_repr = ", ".join(map(str, value.all()))
249
- elif (
250
- isinstance(f.remote_field, (ForeignObjectRel, OneToOneField))
251
- and value is not None
252
- ):
253
- result_repr = self.get_admin_url(f.remote_field, value)
254
- else:
255
- result_repr = display_for_field(value, f, self.empty_value_display)
256
- return conditional_escape(result_repr)
257
- result_repr = linebreaksbr(result_repr)
258
- return conditional_escape(result_repr)
259
-
260
- def _preprocess_field(self, contents: str) -> str:
261
- if (
262
- hasattr(self.model_admin, "readonly_preprocess_fields")
263
- and self.field["field"] in self.model_admin.readonly_preprocess_fields
264
- ):
265
- func = self.model_admin.readonly_preprocess_fields[self.field["field"]]
266
- if isinstance(func, str):
267
- contents = import_string(func)(contents)
268
- elif callable(func):
269
- contents = func(contents)
270
-
271
- return contents
272
-
273
-
274
126
  helpers.AdminReadonlyField = UnfoldAdminReadonlyField
275
127
 
276
128
 
@@ -305,10 +157,14 @@ class ModelAdminMixin:
305
157
  def formfield_for_foreignkey(
306
158
  self, db_field: ForeignKey, request: HttpRequest, **kwargs
307
159
  ) -> Optional[ModelChoiceField]:
160
+ db = kwargs.get("using")
161
+
308
162
  # Overrides widgets for all related fields
309
163
  if "widget" not in kwargs:
310
164
  if db_field.name in self.raw_id_fields:
311
- kwargs["widget"] = UnfoldAdminTextInputWidget()
165
+ kwargs["widget"] = UnfoldForeignKeyRawIdWidget(
166
+ db_field.remote_field, self.admin_site, using=db
167
+ )
312
168
  elif (
313
169
  db_field.name not in self.get_autocomplete_fields(request)
314
170
  and db_field.name not in self.radio_fields
@@ -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>