django-unfold 0.43.0__py3-none-any.whl → 0.44.0__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. {django_unfold-0.43.0.dist-info → django_unfold-0.44.0.dist-info}/METADATA +1 -1
  2. {django_unfold-0.43.0.dist-info → django_unfold-0.44.0.dist-info}/RECORD +129 -117
  3. {django_unfold-0.43.0.dist-info → django_unfold-0.44.0.dist-info}/WHEEL +1 -1
  4. unfold/contrib/filters/admin.py +5 -5
  5. unfold/contrib/filters/templates/unfold/filters/filters_date_range.html +1 -1
  6. unfold/contrib/filters/templates/unfold/filters/filters_datetime_range.html +1 -1
  7. unfold/contrib/filters/templates/unfold/filters/filters_numeric_range.html +1 -1
  8. unfold/contrib/filters/templates/unfold/filters/filters_numeric_single.html +1 -1
  9. unfold/contrib/filters/templates/unfold/filters/filters_numeric_slider.html +3 -3
  10. unfold/contrib/forms/templates/unfold/forms/array.html +3 -3
  11. unfold/contrib/forms/templates/unfold/forms/helpers/toolbar.html +25 -25
  12. unfold/contrib/forms/widgets.py +5 -5
  13. unfold/contrib/guardian/templates/admin/guardian/model/obj_perms_manage.html +1 -1
  14. unfold/contrib/guardian/templates/admin/guardian/model/obj_perms_manage_group.html +2 -2
  15. unfold/contrib/guardian/templates/admin/guardian/model/obj_perms_manage_user.html +2 -2
  16. unfold/contrib/guardian/templates/unfold/guardian/group_form.html +8 -8
  17. unfold/contrib/guardian/templates/unfold/guardian/user_form.html +8 -8
  18. unfold/contrib/import_export/templates/admin/import_export/change_form.html +1 -1
  19. unfold/contrib/import_export/templates/admin/import_export/export.html +4 -4
  20. unfold/contrib/import_export/templates/admin/import_export/import_confirm.html +4 -4
  21. unfold/contrib/import_export/templates/admin/import_export/import_errors.html +2 -2
  22. unfold/contrib/import_export/templates/admin/import_export/import_form.html +2 -2
  23. unfold/contrib/import_export/templates/admin/import_export/import_preview.html +5 -5
  24. unfold/contrib/import_export/templates/admin/import_export/import_validation.html +8 -8
  25. unfold/contrib/simple_history/templates/simple_history/object_history.html +2 -2
  26. unfold/contrib/simple_history/templates/simple_history/object_history_form.html +1 -1
  27. unfold/contrib/simple_history/templates/simple_history/object_history_list.html +9 -9
  28. unfold/contrib/simple_history/templates/simple_history/submit_line.html +4 -4
  29. unfold/forms.py +13 -2
  30. unfold/settings.py +20 -7
  31. unfold/sites.py +23 -8
  32. unfold/static/admin/js/inlines.js +2 -2
  33. unfold/static/unfold/css/styles.css +1 -1
  34. unfold/static/unfold/js/alpine.resize.js +1 -0
  35. unfold/static/unfold/js/app.js +52 -71
  36. unfold/static/unfold/js/htmx.js +1 -1
  37. unfold/styles.css +67 -71
  38. unfold/templates/admin/actions.html +19 -17
  39. unfold/templates/admin/app_list.html +3 -3
  40. unfold/templates/admin/auth/user/add_form.html +1 -1
  41. unfold/templates/admin/auth/user/change_password.html +2 -2
  42. unfold/templates/admin/base.html +1 -1
  43. unfold/templates/admin/change_list.html +24 -30
  44. unfold/templates/admin/change_list_results.html +40 -6
  45. unfold/templates/admin/date_hierarchy.html +1 -1
  46. unfold/templates/admin/delete_confirmation.html +7 -7
  47. unfold/templates/admin/delete_selected_confirmation.html +7 -7
  48. unfold/templates/admin/edit_inline/stacked.html +4 -4
  49. unfold/templates/admin/edit_inline/tabular.html +8 -151
  50. unfold/templates/admin/filter.html +7 -7
  51. unfold/templates/admin/includes/fieldset.html +2 -2
  52. unfold/templates/admin/includes/object_delete_summary.html +1 -1
  53. unfold/templates/admin/login.html +4 -4
  54. unfold/templates/admin/nav_sidebar.html +1 -8
  55. unfold/templates/admin/object_history.html +7 -7
  56. unfold/templates/admin/pagination.html +36 -30
  57. unfold/templates/admin/search_form.html +11 -9
  58. unfold/templates/admin/submit_line.html +11 -11
  59. unfold/templates/auth/widgets/read_only_password_hash.html +1 -1
  60. unfold/templates/registration/logged_out.html +3 -3
  61. unfold/templates/registration/password_change_done.html +1 -1
  62. unfold/templates/registration/password_change_form.html +1 -1
  63. unfold/templates/unfold/components/button.html +1 -1
  64. unfold/templates/unfold/components/card.html +4 -4
  65. unfold/templates/unfold/components/chart/cohort.html +1 -1
  66. unfold/templates/unfold/components/navigation.html +2 -2
  67. unfold/templates/unfold/components/separator.html +1 -1
  68. unfold/templates/unfold/components/table.html +6 -6
  69. unfold/templates/unfold/components/tracker.html +1 -1
  70. unfold/templates/unfold/helpers/account_links.html +6 -6
  71. unfold/templates/unfold/helpers/actions_row.html +5 -5
  72. unfold/templates/unfold/helpers/add_link.html +1 -1
  73. unfold/templates/unfold/helpers/app_list.html +10 -10
  74. unfold/templates/unfold/helpers/app_list_default.html +10 -10
  75. unfold/templates/unfold/helpers/boolean.html +1 -1
  76. unfold/templates/unfold/helpers/breadcrumb_item.html +1 -1
  77. unfold/templates/unfold/helpers/change_list_actions.html +13 -0
  78. unfold/templates/unfold/helpers/change_list_filter.html +31 -0
  79. unfold/templates/unfold/helpers/change_list_filter_actions.html +23 -0
  80. unfold/templates/unfold/helpers/delete_submit_line.html +2 -2
  81. unfold/templates/unfold/helpers/display_header.html +3 -3
  82. unfold/templates/unfold/helpers/edit_inline/tabular_delete.html +13 -0
  83. unfold/templates/unfold/helpers/edit_inline/tabular_error.html +8 -0
  84. unfold/templates/unfold/helpers/edit_inline/tabular_field.html +25 -0
  85. unfold/templates/unfold/helpers/edit_inline/tabular_heading.html +25 -0
  86. unfold/templates/unfold/helpers/edit_inline/tabular_row.html +27 -0
  87. unfold/templates/unfold/helpers/edit_inline/tabular_title.html +49 -0
  88. unfold/templates/unfold/helpers/field_readonly.html +1 -1
  89. unfold/templates/unfold/helpers/field_readonly_value.html +1 -1
  90. unfold/templates/unfold/helpers/fieldset_row.html +5 -73
  91. unfold/templates/unfold/helpers/fieldset_row_checkbox.html +45 -0
  92. unfold/templates/unfold/helpers/fieldset_row_field.html +21 -0
  93. unfold/templates/unfold/helpers/fieldsets_tabs.html +2 -2
  94. unfold/templates/unfold/helpers/header.html +1 -1
  95. unfold/templates/unfold/helpers/history.html +4 -4
  96. unfold/templates/unfold/helpers/label.html +1 -1
  97. unfold/templates/unfold/helpers/language_switch.html +3 -3
  98. unfold/templates/unfold/helpers/messages/debug.html +1 -1
  99. unfold/templates/unfold/helpers/messages/error.html +1 -1
  100. unfold/templates/unfold/helpers/messages/errornote.html +1 -1
  101. unfold/templates/unfold/helpers/messages/info.html +1 -1
  102. unfold/templates/unfold/helpers/messages/success.html +1 -1
  103. unfold/templates/unfold/helpers/messages/warning.html +1 -1
  104. unfold/templates/unfold/helpers/navigation.html +3 -11
  105. unfold/templates/unfold/helpers/navigation_header.html +13 -0
  106. unfold/templates/unfold/helpers/pagination_ellipsis.html +1 -1
  107. unfold/templates/unfold/helpers/search.html +5 -5
  108. unfold/templates/unfold/helpers/search_results.html +2 -2
  109. unfold/templates/unfold/helpers/site_icon.html +7 -5
  110. unfold/templates/unfold/helpers/site_logo.html +1 -1
  111. unfold/templates/unfold/helpers/submit.html +1 -1
  112. unfold/templates/unfold/helpers/tab_action.html +2 -2
  113. unfold/templates/unfold/helpers/tab_list.html +9 -9
  114. unfold/templates/unfold/helpers/theme_switch.html +5 -5
  115. unfold/templates/unfold/helpers/userlinks.html +4 -0
  116. unfold/templates/unfold/helpers/welcomemsg.html +7 -3
  117. unfold/templates/unfold/layouts/base_simple.html +2 -2
  118. unfold/templates/unfold/layouts/skeleton.html +11 -5
  119. unfold/templates/unfold/widgets/clearable_file_input.html +6 -6
  120. unfold/templates/unfold/widgets/clearable_file_input_small.html +7 -7
  121. unfold/templates/unfold/widgets/foreign_key_raw_id.html +1 -1
  122. unfold/templates/unfold/widgets/radio.html +1 -1
  123. unfold/templates/unfold/widgets/range.html +1 -1
  124. unfold/templates/unfold/widgets/related_widget_wrapper.html +4 -4
  125. unfold/templates/unfold/widgets/textarea_expandable.html +1 -1
  126. unfold/templatetags/unfold.py +104 -0
  127. unfold/templatetags/unfold_list.py +9 -4
  128. unfold/widgets.py +31 -28
  129. unfold/templates/unfold/change_list_filter.html +0 -57
  130. {django_unfold-0.43.0.dist-info → django_unfold-0.44.0.dist-info}/LICENSE.md +0 -0
@@ -2,21 +2,21 @@
2
2
 
3
3
  <div {% if not is_popup %}id="submit-row"{% endif %} class="relative z-20 {% if not is_popup %} mt-20 lg:mt-8{% endif %}">
4
4
  <div class="{% if not is_popup %}bottom-0 fixed left-0 right-0{% endif %}" {% if not is_popup %}x-bind:class="{'xl:left-0': !sidebarDesktopOpen, 'xl:left-72': sidebarDesktopOpen}"{% endif %}>
5
- <div class="bg-white dark:bg-gray-900 {% if not is_popup %}border-t px-4 py-4 relative scrollable-top lg:px-8 dark:border-gray-800{% endif %}">
5
+ <div class="bg-white dark:bg-base-900 {% if not is_popup %}border-t border-base-200 px-4 py-4 relative scrollable-top lg:px-8 dark:border-base-800{% endif %}">
6
6
  <div class="container flex flex-col-reverse gap-3 items-center mx-auto lg:flex-row-reverse">
7
7
  {% if not revert_disabled %}
8
- <button type="submit" class="bg-primary-600 block border border-transparent font-medium px-3 py-2 rounded-md text-sm text-white w-full lg:w-auto" name="_save" {{ onclick_attrib }}>
8
+ <button type="submit" class="bg-primary-600 block border border-transparent font-medium px-3 py-2 rounded text-sm text-white w-full lg:w-auto" name="_save" {{ onclick_attrib }}>
9
9
  {% trans 'Revert' %}
10
10
  </button>
11
11
  {% endif %}
12
12
 
13
13
  {% if change_history %}
14
- <button type="submit" class="bg-primary-600 block border border-transparent font-medium px-3 py-2 rounded-md text-sm text-white w-full lg:w-auto" name="_change_history" {{ onclick_attrib }}>
14
+ <button type="submit" class="bg-primary-600 block border border-transparent font-medium px-3 py-2 rounded text-sm text-white w-full lg:w-auto" name="_change_history" {{ onclick_attrib }}>
15
15
  {% trans 'Change History' %}
16
16
  </button>
17
17
  {% endif %}
18
18
 
19
- <a href="{{ history_url }}" class="border font-medium mr-auto px-3 py-2 rounded-md text-sm text-gray-500 text-center transition-all w-full hover:bg-gray-50 lg:block lg:w-auto dark:border-gray-700 dark:text-font-default-dark dark:hover:text-gray-200 dark:hover:bg-gray-900">
19
+ <a href="{{ history_url }}" class="border border-base-200 font-medium mr-auto px-3 py-2 rounded text-sm text-base-500 text-center transition-all w-full hover:bg-base-50 lg:block lg:w-auto dark:border-base-700 dark:text-font-default-dark dark:hover:text-base-200 dark:hover:bg-base-900">
20
20
  {% trans 'Close' %}
21
21
  </a>
22
22
  </div>
unfold/forms.py CHANGED
@@ -25,7 +25,6 @@ from django.utils.translation import gettext_lazy as _
25
25
  from .widgets import (
26
26
  BASE_INPUT_CLASSES,
27
27
  INPUT_CLASSES,
28
- SELECT_CLASSES,
29
28
  UnfoldAdminPasswordInput,
30
29
  UnfoldAdminRadioSelectWidget,
31
30
  )
@@ -40,7 +39,19 @@ class ActionForm(forms.Form):
40
39
  label="",
41
40
  widget=forms.Select(
42
41
  {
43
- "class": " ".join([*SELECT_CLASSES, "max-w-full", "lg:!w-64"]),
42
+ "class": " ".join(
43
+ [
44
+ "appearance-none",
45
+ "bg-white/20",
46
+ "font-medium",
47
+ "grow",
48
+ "px-3",
49
+ "py-2",
50
+ "pr-8",
51
+ "rounded",
52
+ "lg:min-w-72",
53
+ ]
54
+ ),
44
55
  "aria-label": _("Select action to run"),
45
56
  "x-model": "action",
46
57
  }
unfold/settings.py CHANGED
@@ -14,13 +14,18 @@ CONFIG_DEFAULTS = {
14
14
  "SHOW_VIEW_ON_SITE": True,
15
15
  "SHOW_LANGUAGES": False,
16
16
  "COLORS": {
17
- "font": {
18
- "subtle-light": "107 114 128", # text-gray-500
19
- "subtle-dark": "156 163 175", # text-gray-400
20
- "default-light": "75 85 99", # text-gray-600
21
- "default-dark": "209 213 219", # text-gray-300
22
- "important-light": "17 24 39", # text-gray-900
23
- "important-dark": "243 244 246", # text-gray-100
17
+ "base": {
18
+ "50": "249 250 251",
19
+ "100": "243 244 246",
20
+ "200": "229 231 235",
21
+ "300": "209 213 219",
22
+ "400": "156 163 175",
23
+ "500": "107 114 128",
24
+ "600": "75 85 99",
25
+ "700": "55 65 81",
26
+ "800": "31 41 55",
27
+ "900": "17 24 39",
28
+ "950": "3 7 18",
24
29
  },
25
30
  "primary": {
26
31
  "50": "250 245 255",
@@ -35,6 +40,14 @@ CONFIG_DEFAULTS = {
35
40
  "900": "88 28 135",
36
41
  "950": "59 7 100",
37
42
  },
43
+ "font": {
44
+ "subtle-light": "var(--color-base-500)", # text-base-500
45
+ "subtle-dark": "var(--color-base-400)", # text-base-400
46
+ "default-light": "var(--color-base-600)", # text-base-600
47
+ "default-dark": "var(--color-base-300)", # text-base-300
48
+ "important-light": "var(--color-base-900)", # text-base-900
49
+ "important-dark": "var(--color-base-100)", # text-base-100
50
+ },
38
51
  },
39
52
  "DASHBOARD_CALLBACK": None,
40
53
  "ENVIRONMENT": None,
unfold/sites.py CHANGED
@@ -49,14 +49,23 @@ class UnfoldAdminSite(AdminSite):
49
49
  self.site_url = get_config(self.settings_name)["SITE_URL"]
50
50
 
51
51
  def get_urls(self) -> List[URLPattern]:
52
- urlpatterns = [
53
- path("search/", self.admin_view(self.search), name="search"),
54
- path(
55
- "toggle-sidebar/",
56
- self.admin_view(self.toggle_sidebar),
57
- name="toggle_sidebar",
58
- ),
59
- ] + super().get_urls()
52
+ extra_urls = []
53
+
54
+ if hasattr(self, "extra_urls") and callable(self.extra_urls):
55
+ extra_urls = self.extra_urls()
56
+
57
+ urlpatterns = (
58
+ [
59
+ path("search/", self.admin_view(self.search), name="search"),
60
+ path(
61
+ "toggle-sidebar/",
62
+ self.admin_view(self.toggle_sidebar),
63
+ name="toggle_sidebar",
64
+ ),
65
+ ]
66
+ + extra_urls
67
+ + super().get_urls()
68
+ )
60
69
 
61
70
  return urlpatterns
62
71
 
@@ -89,6 +98,9 @@ class UnfoldAdminSite(AdminSite):
89
98
  "colors": self._process_colors(
90
99
  get_config(self.settings_name)["COLORS"]
91
100
  ),
101
+ "border_radius": get_config(self.settings_name).get(
102
+ "BORDER_RADIUS", "6px"
103
+ ),
92
104
  "tab_list": self.get_tabs_list(request),
93
105
  "styles": [
94
106
  self._get_value(style, request)
@@ -120,6 +132,9 @@ class UnfoldAdminSite(AdminSite):
120
132
  except ImportError:
121
133
  pass
122
134
 
135
+ if hasattr(self, "extra_context") and callable(self.extra_context):
136
+ return self.extra_context(context, request)
137
+
123
138
  return context
124
139
 
125
140
  def index(
@@ -252,9 +252,9 @@
252
252
  const showAddButton =
253
253
  maxForms.val() === "" || maxForms.val() - totalForms.val() > 0;
254
254
  if ($this.length && showAddButton) {
255
- addButton.parent().show();
255
+ addButton.parent().parent().show(); // !CHANGED from original
256
256
  } else {
257
- addButton.parent().hide();
257
+ addButton.parent().parent().hide(); // !CHANGED from original
258
258
  }
259
259
 
260
260
  return this;