django-unfold 0.33.0__py3-none-any.whl → 0.35.0__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. {django_unfold-0.33.0.dist-info → django_unfold-0.35.0.dist-info}/METADATA +33 -5
  2. {django_unfold-0.33.0.dist-info → django_unfold-0.35.0.dist-info}/RECORD +74 -73
  3. unfold/admin.py +12 -14
  4. unfold/contrib/filters/admin.py +34 -1
  5. unfold/contrib/filters/forms.py +36 -3
  6. unfold/contrib/filters/templates/unfold/filters/filters_date_range.html +1 -1
  7. unfold/contrib/filters/templates/unfold/filters/filters_datetime_range.html +1 -1
  8. unfold/contrib/filters/templates/unfold/filters/filters_numeric_range.html +1 -1
  9. unfold/contrib/filters/templates/unfold/filters/filters_numeric_single.html +1 -1
  10. unfold/contrib/filters/templates/unfold/filters/filters_numeric_slider.html +1 -1
  11. unfold/contrib/guardian/templates/unfold/guardian/group_form.html +10 -10
  12. unfold/contrib/guardian/templates/unfold/guardian/user_form.html +10 -10
  13. unfold/contrib/import_export/templates/admin/import_export/import_confirm.html +1 -1
  14. unfold/contrib/import_export/templates/admin/import_export/import_errors.html +3 -3
  15. unfold/contrib/import_export/templates/admin/import_export/import_preview.html +6 -6
  16. unfold/contrib/import_export/templates/admin/import_export/import_validation.html +8 -8
  17. unfold/contrib/simple_history/templates/simple_history/object_history_list.html +18 -18
  18. unfold/decorators.py +2 -2
  19. unfold/fields.py +2 -2
  20. unfold/forms.py +2 -1
  21. unfold/static/unfold/css/styles.css +1 -1
  22. unfold/static/unfold/js/app.js +23 -0
  23. unfold/static/unfold/js/select2.init.js +15 -0
  24. unfold/styles.css +6 -10
  25. unfold/templates/admin/actions.html +14 -12
  26. unfold/templates/admin/app_list.html +3 -5
  27. unfold/templates/admin/change_form.html +1 -1
  28. unfold/templates/admin/change_list.html +4 -4
  29. unfold/templates/admin/change_list_results.html +4 -4
  30. unfold/templates/admin/delete_confirmation.html +9 -9
  31. unfold/templates/admin/delete_selected_confirmation.html +9 -9
  32. unfold/templates/admin/edit_inline/stacked.html +64 -58
  33. unfold/templates/admin/edit_inline/tabular.html +11 -11
  34. unfold/templates/admin/filter.html +5 -5
  35. unfold/templates/admin/includes/object_delete_summary.html +2 -2
  36. unfold/templates/admin/object_history.html +9 -9
  37. unfold/templates/admin/pagination.html +3 -3
  38. unfold/templates/admin/submit_line.html +7 -7
  39. unfold/templates/unfold/change_list_filter.html +3 -3
  40. unfold/templates/unfold/components/progress.html +1 -1
  41. unfold/templates/unfold/components/table.html +4 -4
  42. unfold/templates/unfold/components/title.html +1 -1
  43. unfold/templates/unfold/helpers/account_links.html +2 -2
  44. unfold/templates/unfold/helpers/actions_row.html +14 -12
  45. unfold/templates/unfold/helpers/add_link.html +2 -2
  46. unfold/templates/unfold/helpers/app_list.html +7 -7
  47. unfold/templates/unfold/helpers/app_list_default.html +7 -7
  48. unfold/templates/unfold/helpers/breadcrumb_item.html +1 -1
  49. unfold/templates/unfold/helpers/display_header.html +4 -2
  50. unfold/templates/unfold/helpers/field_readonly_value.html +1 -1
  51. unfold/templates/unfold/helpers/fieldset_row.html +1 -1
  52. unfold/templates/unfold/helpers/fieldsets_tabs.html +1 -1
  53. unfold/templates/unfold/helpers/help_text.html +1 -1
  54. unfold/templates/unfold/helpers/history.html +3 -3
  55. unfold/templates/unfold/helpers/label.html +6 -6
  56. unfold/templates/unfold/helpers/messages.html +12 -1
  57. unfold/templates/unfold/helpers/navigation.html +1 -1
  58. unfold/templates/unfold/helpers/search_results.html +2 -2
  59. unfold/templates/unfold/helpers/site_icon.html +1 -1
  60. unfold/templates/unfold/helpers/tab_action.html +1 -1
  61. unfold/templates/unfold/helpers/tab_list.html +9 -5
  62. unfold/templates/unfold/helpers/theme_switch.html +2 -2
  63. unfold/templates/unfold/helpers/welcomemsg.html +5 -3
  64. unfold/templates/unfold/layouts/skeleton.html +2 -2
  65. unfold/templates/unfold/widgets/clearable_file_input.html +2 -2
  66. unfold/templates/unfold/widgets/clearable_file_input_small.html +2 -2
  67. unfold/templates/unfold/widgets/foreign_key_raw_id.html +8 -4
  68. unfold/templates/unfold/widgets/radio_option.html +1 -1
  69. unfold/templates/unfold/widgets/split_datetime.html +2 -2
  70. unfold/templates/unfold/widgets/split_datetime_vertical.html +2 -2
  71. unfold/templatetags/unfold_list.py +6 -7
  72. unfold/widgets.py +21 -6
  73. {django_unfold-0.33.0.dist-info → django_unfold-0.35.0.dist-info}/LICENSE.md +0 -0
  74. {django_unfold-0.33.0.dist-info → django_unfold-0.35.0.dist-info}/WHEEL +0 -0
@@ -14,14 +14,14 @@
14
14
  <label for="{{ widget.checkbox_id }}" class="flex items-center">
15
15
  <input type="checkbox"{% if widget.class %} class="{{ widget.class }}"{% endif %} name="{{ widget.checkbox_name }}" id="{{ widget.checkbox_id }}" />
16
16
 
17
- <span class="ml-2 text-gray-500 dark:text-gray-300">
17
+ <span class="ml-2">
18
18
  {{ widget.clear_checkbox_label }}
19
19
  </span>
20
20
  </label>
21
21
  </div>
22
22
  {% endif %}
23
23
 
24
- <input type="text" value="{% if widget.value %}{{ widget.value.url }}{% else %}{% trans 'Choose file to upload' %}{% endif %}" disabled class="bg-white flex-grow font-medium px-3 py-2 text-ellipsis dark:bg-gray-900 {% if widget.value %}text-gray-500 dark:text-gray-300{% else %}text-gray-300 dark:text-gray-300{% endif %}">
24
+ <input type="text" aria-label="{% trans 'Choose file to upload' %}" value="{% if widget.value %}{{ widget.value.url }}{% else %}{% trans 'Choose file to upload' %}{% endif %}" disabled class="bg-white flex-grow font-medium px-3 py-2 text-ellipsis dark:bg-gray-900 {% if widget.value %}text-gray-500 dark:text-gray-300{% else %}text-gray-300 dark:text-gray-300{% endif %}">
25
25
 
26
26
  <div class="flex flex-none items-center leading-none self-stretch">
27
27
  <div class="hidden">
@@ -7,14 +7,14 @@
7
7
  <label for="{{ widget.checkbox_id }}" class="flex items-center">
8
8
  <input type="checkbox"{% if widget.class %} class="{{ widget.class }}"{% endif %} name="{{ widget.checkbox_name }}" id="{{ widget.checkbox_id }}" />
9
9
 
10
- <span class="ml-2 text-gray-500 dark:text-gray-300">
10
+ <span class="ml-2">
11
11
  {{ widget.clear_checkbox_label }}
12
12
  </span>
13
13
  </label>
14
14
  </div>
15
15
  {% endif %}
16
16
 
17
- <input type="text" value="{% if widget.value %}{{ widget.value.url }}{% else %}{% trans 'Choose file to upload' %}{% endif %}" disabled class="bg-white flex-grow font-medium px-3 py-2 text-ellipsis dark:bg-gray-900 {% if widget.value %}text-gray-500 dark:text-gray-300{% else %}text-gray-300 dark:text-gray-300{% endif %}">
17
+ <input type="text" aria-label="{% trans 'Choose file to upload' %}" value="{% if widget.value %}{{ widget.value.url }}{% else %}{% trans 'Choose file to upload' %}{% endif %}" disabled class="bg-white flex-grow font-medium px-3 py-2 text-ellipsis dark:bg-gray-900 {% if widget.value %}text-gray-500 dark:text-gray-300{% else %}text-gray-300 dark:text-gray-300{% endif %}">
18
18
 
19
19
  <div class="flex flex-none items-center leading-none self-stretch">
20
20
  <input type="{{ widget.type }}" name="{{ widget.name }}" class="{{ widget.file_input_class }}" {% include "django/forms/widgets/attrs.html" %} />
@@ -2,14 +2,18 @@
2
2
  {% include 'django/forms/widgets/input.html' %}
3
3
 
4
4
  {% if related_url %}
5
- <a href="{{ related_url }}" class="related-lookup related-widget-wrapper-link view-related bg-white border cursor-pointer flex items-center h-9.5 justify-center ml-2 rounded shadow-sm shrink-0 text-gray-400 text-sm w-9.5 hover:text-gray-700 dark:bg-gray-900 dark:border-gray-700 dark:text-gray-500 dark:hover:text-gray-200" id="lookup_id_{{ widget.name }}">
5
+ <a href="{{ related_url }}" class="related-lookup view-related bg-white border cursor-pointer flex items-center h-9.5 justify-center ml-2 rounded shadow-sm shrink-0 text-gray-400 text-sm w-9.5 hover:text-gray-700 dark:bg-gray-900 dark:border-gray-700 dark:text-gray-500 dark:hover:text-gray-200" id="lookup_id_{{ widget.name }}">
6
6
  <span class="material-symbols-outlined text-sm">search</span>
7
7
  </a>
8
8
  {% endif %}
9
9
 
10
- {% if link_label and link_url %}
11
- <a href="{{ link_url }}" title="{{ link_label }}" class="bg-white border cursor-pointer flex items-center h-9.5 justify-center ml-2 rounded shadow-sm shrink-0 text-gray-400 text-sm w-9.5 hover:text-gray-700 dark:bg-gray-900 dark:border-gray-700 dark:text-gray-500 dark:hover:text-gray-200">
12
- <span class="material-symbols-outlined text-sm">visibility</span>
10
+ {% if link_url %}
11
+ <a href="{{ link_url }}" title="{{ link_label }}" class="flex items-center h-9.5 justify-center ml-4 rounded shrink-0 text-primary-600 text-sm dark:text-primary-500">
12
+ {{ link_label }}
13
13
  </a>
14
+ {% else %}
15
+ <span title="{{ link_label }}" class="bg-white flex items-center h-9.5 justify-center ml-4 rounded shrink-0 text-sm">
16
+ {{ link_label }}
17
+ </span>
14
18
  {% endif %}
15
19
  </div>
@@ -5,7 +5,7 @@
5
5
  {% include "django/forms/widgets/input.html" %}
6
6
 
7
7
  {% if widget.wrap_label %}
8
- <span class="text-sm text-gray-900 dark:text-gray-200">
8
+ <span>
9
9
  {{ widget.label }}
10
10
  </span>
11
11
  </label>
@@ -1,6 +1,6 @@
1
1
  <div class="datetime flex flex-col gap-2 max-w-2xl lg:flex-row lg:group-[.field-row]:flex-row lg:group-[.field-row]:items-center lg:group-[.field-tabular]:flex-row lg:group-[.field-tabular]:items-center">
2
2
  <div class="basis-1/2 flex flex-col lg:group-[.field-row]:flex-row group-[.field-row]:gap-2 lg:group-[.field-tabular]:flex-row group-[.field-tabular]:gap-2">
3
- <div class="font-medium mb-2 text-gray-500 text-sm dark:text-gray-300 group-[.field-row]:mb-0 group-[.field-row]:flex group-[.field-row]:items-center group-[.field-tabular]:mb-0 group-[.field-tabular]:flex group-[.field-tabular]:items-center">
3
+ <div class="font-medium mb-2 group-[.field-row]:mb-0 group-[.field-row]:flex group-[.field-row]:items-center group-[.field-tabular]:mb-0 group-[.field-tabular]:flex group-[.field-tabular]:items-center">
4
4
  {{ date_label }}
5
5
  </div>
6
6
 
@@ -12,7 +12,7 @@
12
12
  </div>
13
13
 
14
14
  <div class="basis-1/2 flex flex-col lg:ml-auto md:mt-0 lg:group-[.field-row]:flex-row group-[.field-row]:gap-2 lg:group-[.field-tabular]:flex-row group-[.field-tabular]:gap-2">
15
- <div class="font-medium mb-2 text-gray-500 text-sm dark:text-gray-300 group-[.field-row]:mb-0 group-[.field-row]:flex group-[.field-row]:items-center group-[.field-tabular]:mb-0 group-[.field-tabular]:flex group-[.field-tabular]:items-center">
15
+ <div class="font-medium mb-2 group-[.field-row]:mb-0 group-[.field-row]:flex group-[.field-row]:items-center group-[.field-tabular]:mb-0 group-[.field-tabular]:flex group-[.field-tabular]:items-center">
16
16
  {{ time_label }}
17
17
  </div>
18
18
 
@@ -1,7 +1,7 @@
1
1
  <div class="datetime flex flex-col max-w-2xl">
2
2
  <div class="flex flex-col flex-wrap mb-2">
3
3
  {% if date_label %}
4
- <div class="mb-2 text-gray-500 text-sm dark:text-gray-200">
4
+ <div class="mb-2">
5
5
  {{ date_label }}
6
6
  </div>
7
7
  {% endif %}
@@ -15,7 +15,7 @@
15
15
 
16
16
  <div class="flex flex-col flex-wrap mt-3 md:mt-0">
17
17
  {% if time_label %}
18
- <div class="mb-2 text-gray-500 text-sm dark:text-gray-200">
18
+ <div class="mb-2">
19
19
  {{ time_label }}
20
20
  </div>
21
21
  {% endif %}
@@ -37,9 +37,7 @@ from ..widgets import UnfoldBooleanWidget
37
37
  register = Library()
38
38
 
39
39
  LINK_CLASSES = [
40
- "text-gray-600",
41
40
  "truncate",
42
- "dark:text-gray-300",
43
41
  ]
44
42
 
45
43
  ROW_CLASSES = [
@@ -54,17 +52,17 @@ ROW_CLASSES = [
54
52
  "px-3",
55
53
  "py-2",
56
54
  "text-left",
57
- "text-gray-500",
58
55
  "text-sm",
59
56
  "before:flex",
60
57
  "before:capitalize",
61
58
  "before:content-[attr(data-label)]",
62
59
  "before:items-center",
60
+ "before:font-semibold",
63
61
  "before:mr-auto",
64
- "before:text-gray-500",
62
+ "before:text-gray-900",
65
63
  "first:border-t-0",
66
- "dark:before:text-gray-300",
67
64
  "dark:text-gray-300",
65
+ "dark:before:text-gray-100",
68
66
  "lg:before:hidden",
69
67
  "lg:first:border-t",
70
68
  "lg:py-3",
@@ -84,13 +82,14 @@ CHECKBOX_CLASSES = [
84
82
  "before:block",
85
83
  "before:capitalize",
86
84
  "before:content-[attr(data-label)]",
85
+ "before:font-semibold",
87
86
  "before:mr-auto",
88
- "before:text-gray-500",
87
+ "before:text-gray-100",
89
88
  "lg:before:hidden",
90
89
  "lg:border-t",
91
90
  "lg:border-gray-200",
92
91
  "lg:table-cell",
93
- "dark:before:text-gray-300",
92
+ "dark:before:text-gray-100",
94
93
  "dark:lg:border-gray-800",
95
94
  ]
96
95
 
unfold/widgets.py CHANGED
@@ -25,6 +25,7 @@ from django.forms import (
25
25
  NumberInput,
26
26
  PasswordInput,
27
27
  Select,
28
+ SelectMultiple,
28
29
  )
29
30
  from django.utils.translation import gettext_lazy as _
30
31
 
@@ -36,14 +37,14 @@ LABEL_CLASSES = [
36
37
  "mb-2",
37
38
  "text-gray-900",
38
39
  "text-sm",
39
- "dark:text-gray-200",
40
+ "dark:text-gray-100",
40
41
  ]
41
42
 
42
43
  CHECKBOX_LABEL_CLASSES = [
43
44
  "ml-2",
44
45
  "text-sm",
45
46
  "text-gray-900",
46
- "dark:text-gray-200",
47
+ "dark:text-gray-100",
47
48
  ]
48
49
 
49
50
  BASE_CLASSES = [
@@ -123,7 +124,6 @@ PROSE_CLASSES = [
123
124
  "prose-pre:rounded",
124
125
  "prose-headings:font-medium",
125
126
  "prose-a:text-primary-600",
126
- "prose-a:underline",
127
127
  "prose-headings:font-medium",
128
128
  "prose-headings:text-gray-700",
129
129
  "prose-ol:list-decimal",
@@ -241,9 +241,10 @@ SWITCH_CLASSES = [
241
241
  "after:left-1",
242
242
  "after:top-1",
243
243
  "after:w-3",
244
- "checked:bg-primary-600",
244
+ "checked:bg-green-500",
245
245
  "checked:after:left-4",
246
246
  "dark:bg-gray-600",
247
+ "dark:checked:bg-green-700",
247
248
  ]
248
249
 
249
250
 
@@ -480,7 +481,16 @@ class UnfoldAdminSelectWidget(Select):
480
481
  if attrs is None:
481
482
  attrs = {}
482
483
 
483
- attrs["class"] = " ".join(SELECT_CLASSES)
484
+ attrs["class"] = " ".join([*SELECT_CLASSES, attrs.get("class", "")])
485
+ super().__init__(attrs, choices)
486
+
487
+
488
+ class UnfoldAdminSelectMultipleWidget(SelectMultiple):
489
+ def __init__(self, attrs=None, choices=()):
490
+ if attrs is None:
491
+ attrs = {}
492
+
493
+ attrs["class"] = " ".join([*SELECT_CLASSES, attrs.get("class", "")])
484
494
  super().__init__(attrs, choices)
485
495
 
486
496
 
@@ -513,7 +523,12 @@ try:
513
523
  def __init__(self, *args, **kwargs):
514
524
  super().__init__(
515
525
  amount_widget=UnfoldAdminTextInputWidget,
516
- currency_widget=UnfoldAdminSelectWidget(choices=CURRENCY_CHOICES),
526
+ currency_widget=UnfoldAdminSelectWidget(
527
+ choices=CURRENCY_CHOICES,
528
+ attrs={
529
+ "aria-label": _("Select currency"),
530
+ },
531
+ ),
517
532
  )
518
533
 
519
534
  except ImportError: