django-unfold 0.41.0__py3-none-any.whl → 0.42.0__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. {django_unfold-0.41.0.dist-info → django_unfold-0.42.0.dist-info}/METADATA +1 -1
  2. {django_unfold-0.41.0.dist-info → django_unfold-0.42.0.dist-info}/RECORD +45 -43
  3. unfold/admin.py +6 -1
  4. unfold/contrib/filters/admin.py +23 -33
  5. unfold/contrib/guardian/templates/admin/guardian/model/obj_perms_manage.html +1 -1
  6. unfold/contrib/guardian/templates/admin/guardian/model/obj_perms_manage_group.html +1 -1
  7. unfold/contrib/guardian/templates/admin/guardian/model/obj_perms_manage_user.html +1 -1
  8. unfold/contrib/import_export/templates/admin/import_export/export.html +1 -1
  9. unfold/contrib/import_export/templates/admin/import_export/import.html +1 -1
  10. unfold/contrib/simple_history/templates/simple_history/object_history_form.html +1 -1
  11. unfold/contrib/simple_history/templates/simple_history/submit_line.html +1 -1
  12. unfold/settings.py +1 -0
  13. unfold/sites.py +25 -5
  14. unfold/static/unfold/css/styles.css +1 -1
  15. unfold/static/unfold/js/app.js +21 -15
  16. unfold/styles.css +14 -1
  17. unfold/templates/admin/base.html +3 -3
  18. unfold/templates/admin/change_form.html +1 -1
  19. unfold/templates/admin/change_list.html +1 -1
  20. unfold/templates/admin/date_hierarchy.html +5 -5
  21. unfold/templates/admin/delete_confirmation.html +1 -1
  22. unfold/templates/admin/delete_selected_confirmation.html +1 -1
  23. unfold/templates/admin/edit_inline/stacked.html +8 -2
  24. unfold/templates/admin/edit_inline/tabular.html +8 -2
  25. unfold/templates/admin/object_history.html +1 -1
  26. unfold/templates/admin/submit_line.html +2 -2
  27. unfold/templates/unfold/change_list_filter.html +2 -8
  28. unfold/templates/unfold/helpers/account_links.html +1 -1
  29. unfold/templates/unfold/helpers/actions_row.html +9 -7
  30. unfold/templates/unfold/helpers/field_readonly.html +1 -1
  31. unfold/templates/unfold/helpers/form_label.html +1 -1
  32. unfold/templates/unfold/helpers/header.html +1 -1
  33. unfold/templates/unfold/helpers/label.html +1 -1
  34. unfold/templates/unfold/helpers/language_switch.html +27 -0
  35. unfold/templates/unfold/helpers/tab_list.html +3 -3
  36. unfold/templates/unfold/helpers/theme_switch.html +1 -1
  37. unfold/templates/unfold/helpers/userlinks.html +4 -0
  38. unfold/templates/unfold/layouts/base_simple.html +1 -1
  39. unfold/templates/unfold/templatetags/preserve_changelist_filters.html +3 -0
  40. unfold/templates/unfold/widgets/split_datetime_vertical.html +1 -1
  41. unfold/templatetags/unfold.py +29 -2
  42. unfold/utils.py +17 -0
  43. unfold/widgets.py +6 -2
  44. {django_unfold-0.41.0.dist-info → django_unfold-0.42.0.dist-info}/LICENSE.md +0 -0
  45. {django_unfold-0.41.0.dist-info → django_unfold-0.42.0.dist-info}/WHEEL +0 -0
@@ -16,7 +16,7 @@
16
16
  {% if not is_popup %}
17
17
  {% spaceless %}
18
18
  {% block breadcrumbs %}
19
- <div class="px-4 lg:px-12">
19
+ <div class="px-4 lg:px-8">
20
20
  <div class="container mb-12 mx-auto -my-3">
21
21
  <ul class="flex flex-wrap">
22
22
  {% url 'admin:index' as link %}
@@ -31,14 +31,14 @@
31
31
  {% endif %}
32
32
 
33
33
  {% block messages %}
34
- <div class="px-4 lg:px-12">
34
+ <div class="px-4 lg:px-8">
35
35
  <div class="{% if not cl.model_admin.list_fullwidth %}container{% endif %} mx-auto">
36
36
  {% include "unfold/helpers/messages.html" %}
37
37
  </div>
38
38
  </div>
39
39
  {% endblock messages %}
40
40
 
41
- <div class="px-4 pb-12 lg:px-12">
41
+ <div class="px-4 pb-8 lg:px-8">
42
42
  <div id="content" class="{% if not cl.model_admin.list_fullwidth %}container{% endif %} mx-auto {% block coltype %}colM{% endblock %}">
43
43
  {% if cl %}
44
44
  {% tab_list "changelist" cl.opts %}
@@ -11,7 +11,7 @@
11
11
 
12
12
  {% if not is_popup %}
13
13
  {% block breadcrumbs %}
14
- <div class="px-4 lg:px-12">
14
+ <div class="px-4 lg:px-8">
15
15
  <div class="container mb-6 mx-auto -my-3 lg:mb-12">
16
16
  <ul class="flex flex-wrap">
17
17
  {% url 'admin:index' as link %}
@@ -24,7 +24,7 @@
24
24
 
25
25
  {% if not is_popup %}
26
26
  {% block breadcrumbs %}
27
- <div class="px-4 lg:px-12">
27
+ <div class="px-4 lg:px-8">
28
28
  <div class="{% if not cl.model_admin.list_fullwidth %}container{% endif %} mb-6 mx-auto -my-3 lg:mb-12">
29
29
  <ul class="flex flex-wrap">
30
30
  {% url 'admin:index' as link %}
@@ -1,12 +1,12 @@
1
1
  {% if show %}
2
- <div class="xfull mb-4">
3
- <ul class="toplinks flex -mx-2 text-gray-500 text-sm">
2
+ <div class="mb-4">
3
+ <ul class="toplinks flex -mx-2 text-sm">
4
4
  {% block date-hierarchy-toplinks %}
5
5
  {% block date-hierarchy-back %}
6
6
  {% if back %}
7
7
  <li class="date-back px-2">
8
- <a href="{{ back.link }}" class="flex items-center hover:text-primary-600">
9
- <span class="material-symbols-outlined md-16 mr-2 text-gray-400">arrow_back</span> {{ back.title }}
8
+ <a href="{{ back.link }}" class="flex group items-center hover:text-primary-600 dark:hover:text-primary-500">
9
+ <span class="material-symbols-outlined md-16 mr-2 text-gray-400 group-hover:text-primary-600 dark:group-hover:text-primary-500">arrow_back</span> {{ back.title }}
10
10
  </a>
11
11
  </li>
12
12
  {% endif %}
@@ -16,7 +16,7 @@
16
16
  {% for choice in choices %}
17
17
  <li class="px-2">
18
18
  {% if choice.link %}
19
- <a href="{{ choice.link }}" class="hover:text-primary-600">
19
+ <a href="{{ choice.link }}" class="hover:text-primary-600 dark:hover:text-primary-500">
20
20
  {% endif %}
21
21
 
22
22
  {{ choice.title }}
@@ -10,7 +10,7 @@
10
10
  {% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} delete-confirmation{% endblock %}
11
11
 
12
12
  {% block breadcrumbs %}
13
- <div class="px-4 lg:px-12">
13
+ <div class="px-4 lg:px-8">
14
14
  <div class="container mb-6 mx-auto -my-3 lg:mb-12">
15
15
  <ul class="flex flex-wrap">
16
16
  {% url 'admin:index' as link %}
@@ -10,7 +10,7 @@
10
10
  {% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} delete-confirmation delete-selected-confirmation{% endblock %}
11
11
 
12
12
  {% block breadcrumbs %}
13
- <div class="px-4 lg:px-12">
13
+ <div class="px-4 lg:px-8">
14
14
  <div class="container mb-6 mx-auto -my-3 lg:mb-12">
15
15
  <ul class="flex flex-wrap">
16
16
  {% url 'admin:index' as link %}
@@ -1,8 +1,10 @@
1
1
  {% load admin_urls i18n unfold %}
2
2
 
3
3
  <div class="js-inline-admin-formset inline-group" id="{{ inline_admin_formset.formset.prefix }}-group" data-inline-type="stacked" data-inline-formset="{{ inline_admin_formset.inline_formset_data }}" {% if inline_admin_formset.opts.tab %}x-show="activeTab == '{{ inline_admin_formset.opts.verbose_name|slugify }}'"{% else %}x-show="activeTab == 'general'"{% endif %}>
4
- <fieldset class="module {{ inline_admin_formset.classes }}">
5
- <h2 class="bg-gray-100 border border-transparent font-semibold mb-6 px-4 py-3 rounded-md text-font-important-light text-sm lg:-mx-4 dark:bg-white/[.02] dark:border dark:border-gray-800 dark:text-font-important-dark {% if inline_admin_formset.opts.tab %}hidden{% endif %}">
4
+ <fieldset class="module relative {{ inline_admin_formset.classes }}" aria-labelledby="{{ inline_admin_formset.formset.prefix }}-heading">
5
+ {% if inline_admin_formset.is_collapsible %}<details><summary>{% endif %}
6
+
7
+ <h2 id="{{ inline_admin_formset.formset.prefix }}-heading" class="inline-heading bg-gray-100 border border-transparent font-semibold mb-6 px-4 py-3 rounded-md text-font-important-light text-sm lg:-mx-4 dark:bg-white/[.02] dark:border dark:border-gray-800 dark:text-font-important-dark {% if inline_admin_formset.opts.tab %}hidden{% endif %} {% if inline_admin_formset.is_collapsible %} cursor-pointer{% endif %}">
6
8
  {% if inline_admin_formset.formset.max_num == 1 %}
7
9
  {{ inline_admin_formset.opts.verbose_name|capfirst }}
8
10
  {% else %}
@@ -10,6 +12,8 @@
10
12
  {% endif %}
11
13
  </h2>
12
14
 
15
+ {% if inline_admin_formset.is_collapsible %}</summary>{% endif %}
16
+
13
17
  {{ inline_admin_formset.formset.management_form }}
14
18
  {% include "unfold/helpers/messages/error.html" with errors=inline_admin_formset.formset.non_form_errors %}
15
19
 
@@ -92,5 +96,7 @@
92
96
  </div>
93
97
  {% endfor %}
94
98
  </div>
99
+
100
+ {% if inline_admin_formset.is_collapsible %}</details>{% endif %}
95
101
  </fieldset>
96
102
  </div>
@@ -4,8 +4,10 @@
4
4
  <div class="tabular inline-related {% if forloop.last %}last-related{% endif %}">
5
5
  {{ inline_admin_formset.formset.management_form }}
6
6
 
7
- <fieldset class="module {{ inline_admin_formset.classes }} min-w-0">
8
- <h2 class="bg-gray-100 border border-transparent font-semibold mb-6 px-4 py-3 rounded-md text-font-important-light text-sm lg:-mx-4 dark:bg-white/[.02] dark:border dark:border-gray-800 dark:text-font-important-dark {% if inline_admin_formset.opts.tab %}hidden{% endif %}">
7
+ <fieldset class="module relative {{ inline_admin_formset.classes }} min-w-0" aria-labelledby="{{ inline_admin_formset.formset.prefix }}-heading">
8
+ {% if inline_admin_formset.is_collapsible %}<details><summary>{% endif %}
9
+
10
+ <h2 id="{{ inline_admin_formset.formset.prefix }}-heading" class="bg-gray-100 border border-transparent font-semibold mb-6 px-4 py-3 rounded-md text-font-important-light text-sm lg:-mx-4 dark:bg-white/[.02] dark:border dark:border-gray-800 dark:text-font-important-dark {% if inline_admin_formset.opts.tab %}hidden{% endif %} {% if inline_admin_formset.is_collapsible %} cursor-pointer{% endif %}">
9
11
  {% if inline_admin_formset.formset.max_num == 1 %}
10
12
  {{ inline_admin_formset.opts.verbose_name|capfirst }}
11
13
  {% else %}
@@ -13,6 +15,8 @@
13
15
  {% endif %}
14
16
  </h2>
15
17
 
18
+ {% if inline_admin_formset.is_collapsible %}</summary>{% endif %}
19
+
16
20
  {{ inline_admin_formset.formset.non_form_errors }}
17
21
 
18
22
  <div class="border border-gray-200 mb-6 overflow-x-auto rounded-md shadow-sm dark:border-gray-800" data-simplebar data-simplebar-auto-hide="false">
@@ -173,6 +177,8 @@
173
177
  {% endfor %}
174
178
  </table>
175
179
  </div>
180
+
181
+ {% if inline_admin_formset.is_collapsible %}</details>{% endif %}
176
182
  </fieldset>
177
183
  </div>
178
184
  </div>
@@ -2,7 +2,7 @@
2
2
  {% load i18n admin_urls %}
3
3
 
4
4
  {% block breadcrumbs %}
5
- <div class="px-4 lg:px-12">
5
+ <div class="px-4 lg:px-8">
6
6
  <div class="container mb-12 mx-auto -my-3">
7
7
  <ul class="flex flex-wrap">
8
8
  {% url 'admin:index' as link %}
@@ -1,8 +1,8 @@
1
1
  {% load i18n admin_urls %}
2
2
 
3
- <div {% if not is_popup %}id="submit-row"{% endif %} class="relative z-20 {% if not is_popup %} mt-8{% endif %}">
3
+ <div {% if not is_popup %}id="submit-row"{% endif %} class="relative mt-16 z-20">
4
4
  <div class="{% if not is_popup %}lg:bottom-0 lg:fixed lg:left-0 lg: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 %}lg:border-t lg:py-4 relative scrollable-top lg:px-12 dark:border-gray-800{% endif %}">
5
+ <div class="bg-white dark:bg-gray-900 {% if not is_popup %}lg:border-t lg:py-4 relative scrollable-top lg:px-8 dark:border-gray-800{% endif %}">
6
6
  <div class="container flex flex-col-reverse gap-3 items-center mx-auto lg:flex-row-reverse">
7
7
  {% block submit-row %}
8
8
  {% if show_save %}
@@ -1,4 +1,4 @@
1
- {% load i18n admin_list %}
1
+ {% load i18n admin_list unfold %}
2
2
 
3
3
  <div id="changelist-filter" class="backdrop-blur-sm bg-opacity-80 bg-gray-900 flex inset-0 z-50 fixed {% if not cl.model_admin.list_filter_sheet %}2xl:bg-transparent 2xl:relative 2xl:!block 2xl:z-10{% endif %}" x-show="filterOpen">
4
4
  <label for="show-filters" id="changelist-filter-close" class="flex-grow {% if not cl.model_admin.list_filter_sheet %}2xl:hidden{% endif %}" x-on:click="filterOpen = false"></label>
@@ -38,13 +38,7 @@
38
38
  <div class="px-4{% if cl.model_admin.list_filter_submit %} {% endif %}">
39
39
  {% if cl.model_admin.list_filter_submit %}
40
40
  <form id="filter-form" method="get">
41
- {% if request.GET.q %}
42
- <input type="hidden" name="q" value="{{ request.GET.q }}">
43
- {% endif %}
44
-
45
- {% if request.GET.o %}
46
- <input type="hidden" name="o" value="{{ request.GET.o }}">
47
- {% endif %}
41
+ {% preserve_filters %}
48
42
  {% endif %}
49
43
 
50
44
  {% for spec in cl.filter_specs %}
@@ -5,7 +5,7 @@
5
5
  <span class="material-symbols-outlined">person</span>
6
6
  </a>
7
7
 
8
- <nav class="absolute bg-white border flex flex-col leading-none overflow-hidden py-1 -right-2 rounded shadow-lg top-7 w-52 z-50 dark:bg-gray-800 dark:border-gray-700" x-cloak x-show="openUserLinks" @click.outside="openUserLinks = false">
8
+ <nav class="absolute bg-white border flex flex-col leading-none py-1 -right-2 rounded shadow-lg top-7 w-52 z-50 dark:bg-gray-800 dark:border-gray-700" x-cloak x-show="openUserLinks" @click.outside="openUserLinks = false">
9
9
  <div class="border-b border-gray-100 flex flex-row flex-shrink-0 items-start justify-start mb-1 pb-1 dark:border-gray-700">
10
10
  <span class="block mx-1 px-3 py-2 truncate">
11
11
  {% firstof user.get_short_name user.get_username %}
@@ -8,13 +8,15 @@
8
8
  more_horiz
9
9
  </span>
10
10
 
11
- <nav x-anchor.offset.4="$refs.rowDropdown{{ action_id }}" class="bg-white border flex flex-col leading-none py-1 rounded-md shadow-lg text-sm top-7 z-50 w-48 dark:bg-gray-800 dark:border-gray-700" x-cloak x-show="openActionsId{{ action_id }}" @click.outside="openActionsId{{ action_id }} = false">
12
- {% for action in actions %}
13
- <a href="{% url action.raw_path instance_pk %}" class="mx-1 px-3 py-2 rounded-md truncate hover:bg-gray-100 dark:hover:bg-gray-700 dark:hover:text-gray-200"{% for attr_name, attr_value in action.attrs.items %} {{ attr_name }}="{{ attr_value }}"{% endfor %}>
14
- {{ action.title }}
15
- </a>
16
- {% endfor %}
17
- </nav>
11
+ <template x-teleport="body">
12
+ <nav x-anchor.bottom-end.offset.4="$refs.rowDropdown{{ action_id }}" class="bg-white border flex flex-col leading-none py-1 rounded-md shadow-lg text-sm top-7 z-50 w-48 dark:bg-gray-800 dark:border-gray-700" x-cloak x-show="openActionsId{{ action_id }}" @click.outside="openActionsId{{ action_id }} = false">
13
+ {% for action in actions %}
14
+ <a href="{% url action.raw_path instance_pk %}" class="mx-1 px-3 py-2 rounded-md truncate hover:bg-gray-100 dark:hover:bg-gray-700 dark:hover:text-gray-200"{% for attr_name, attr_value in action.attrs.items %} {{ attr_name }}="{{ attr_value }}"{% endfor %}>
15
+ {{ action.title }}
16
+ </a>
17
+ {% endfor %}
18
+ </nav>
19
+ </template>
18
20
  </div>
19
21
  {% endwith %}
20
22
  </td>
@@ -1,5 +1,5 @@
1
1
  <div class="flex group mb-6 flex-col last:mb-4">
2
- <label class="block font-medium mb-2 text-gray-900 text-sm dark:text-gray-200">
2
+ <label class="block font-semibold mb-2 text-gray-900 text-sm dark:text-gray-200">
3
3
  {{ title }}
4
4
  </label>
5
5
 
@@ -1,4 +1,4 @@
1
- <label for="{{ field.id_for_label }}" class="block text-font-important-light dark:text-font-important-dark{% if field.field.widget.input_type == "checkbox" %}{% else %} font-medium mb-2{% endif %}">
1
+ <label for="{{ field.id_for_label }}" class="block text-font-important-light dark:text-font-important-dark{% if field.field.widget.input_type == "checkbox" %}{% else %} font-semibold mb-2{% endif %}">
2
2
  {{ field.label }}
3
3
 
4
4
  {% if field.field.required %}
@@ -1,6 +1,6 @@
1
1
  {% if not is_popup %}
2
2
  {% block header %}
3
- <div class="border-b border-gray-200 mb-6 px-4 lg:px-12 dark:border-gray-800">
3
+ <div class="border-b border-gray-200 mb-6 px-4 lg:px-8 dark:border-gray-800">
4
4
  <div class="{% if not cl.model_admin.list_fullwidth %}container{% endif %} flex items-center h-16 mx-auto py-4">
5
5
  <div id="header-inner" class="flex items-center w-full">
6
6
  <div class="flex items-center w-full">
@@ -10,7 +10,7 @@
10
10
  {% elif type == 'primary' %}
11
11
  bg-primary-100 text-primary-700 dark:bg-primary-500/20 dark:text-primary-400
12
12
  {% else %}
13
- bg-gray-100 text-gray-700 dark:bg-gray-500/20 dark:text-gray-400
13
+ bg-gray-100 text-gray-700 dark:bg-gray-500/20 dark:text-gray-200
14
14
  {% endif %}">
15
15
  {{ text }}
16
16
  </span>
@@ -0,0 +1,27 @@
1
+ {% load i18n %}
2
+
3
+ {% get_current_language as LANGUAGE_CODE %}
4
+ {% get_available_languages as LANGUAGES %}
5
+ {% get_language_info_list for LANGUAGES as languages %}
6
+
7
+
8
+ <div class="relative" x-data="{ openLanguageLinks: false }">
9
+ <a class="block cursor-pointer hover:text-gray-700 dark:hover:text-gray-200" x-on:click="openLanguageLinks = !openLanguageLinks">
10
+ <span class="material-symbols-outlined">translate</span>
11
+ </a>
12
+
13
+ <div class="absolute bg-white border flex flex-col leading-none py-1 -right-2 rounded shadow-lg top-7 w-52 z-50 dark:bg-gray-800 dark:border-gray-700" x-cloak x-show="openLanguageLinks" @click.outside="openLanguageLinks = false">
14
+ {% for language in languages %}
15
+ <form action="{% url 'set_language' %}" method="post" class="flex w-full">
16
+ {% csrf_token %}
17
+
18
+ <input name="next" type="hidden" value="{{ redirect_to }}">
19
+ <input name="language" type="hidden" value="{{ language.code }}">
20
+
21
+ <button type="submit" class="block flex-grow mx-1 px-3 py-2 rounded text-left hover:bg-gray-100 hover:text-gray-700 dark:hover:bg-gray-700 dark:hover:text-gray-200 {% if language.code == LANGUAGE_CODE %}text-primary-600 dark:text-primary-500 dark:hover:!text-primary-500 hover:!text-primary-600{% endif %}">
22
+ {{ language.name_local }} ({{ language.code }})
23
+ </button>
24
+ </form>
25
+ {% endfor %}
26
+ </div>
27
+ </div>
@@ -8,7 +8,7 @@
8
8
  {% for item in tabs_list %}
9
9
  {% if item.has_permission %}
10
10
  <li class="border-b last:border-b-0 md:border-b-0 md:mr-8 dark:border-gray-800">
11
- <a href="{% if item.link_callback %}{{ item.link_callback }}{% else %}{{ item.link }}{% endif %}" class="block px-3 py-2 md:py-4 md:px-0 dark:border-gray-800 {% if item.active %} border-b font-semibold -mb-px text-primary-600 hover:text-primary-600 dark:text-primary-500 dark:hover:text-primary-500 md:border-primary-500 dark:md:!border-primary-600{% else %}font-medium hover:text-gray-700 dark:hover:text-gray-200{% endif %}">
11
+ <a href="{% if item.link_callback %}{{ item.link_callback }}{% else %}{{ item.link }}{% endif %}" class="block px-3 py-2 md:py-4 md:px-0 dark:border-gray-800 {% if item.active %} border-b font-semibold -mb-px text-primary-600 hover:text-primary-600 dark:text-primary-500 dark:hover:text-primary-500 md:border-primary-500 dark:md:!border-primary-600{% else %}font-medium hover:text-primary-600 dark:hover:text-primary-500{% endif %}">
12
12
  {{ item.title }}
13
13
  </a>
14
14
  </li>
@@ -20,7 +20,7 @@
20
20
  <a class="block cursor-pointer font-medium px-3 py-2 md:py-4 md:px-0"
21
21
  href="#general"
22
22
  x-on:click="activeTab = 'general'"
23
- x-bind:class="{'border-b border-gray-200 dark:border-gray-800 md:border-primary-500 dark:md:!border-primary-600 font-semibold -mb-px text-primary-600 dark:text-primary-500': activeTab == 'general', 'hover:text-gray-700 dark:hover:text-gray-200 dark:border-gray-800': activeTab != 'general'}">
23
+ x-bind:class="{'border-b border-gray-200 dark:border-gray-800 md:border-primary-500 dark:md:!border-primary-600 font-semibold -mb-px text-primary-600 dark:text-primary-500': activeTab == 'general', 'hover:text-primary-600 dark:hover:text-primary-500 dark:border-gray-800': activeTab != 'general'}">
24
24
  {% trans "General" %}
25
25
  </a>
26
26
  </li>
@@ -30,7 +30,7 @@
30
30
  <a class="block cursor-pointer font-medium px-3 py-2 md:py-4 md:px-0"
31
31
  href="#{{ inline.opts.verbose_name|slugify }}"
32
32
  x-on:click="activeTab = '{{ inline.opts.verbose_name|slugify }}'"
33
- x-bind:class="{'border-b border-gray-200 dark:border-gray-800 md:border-primary-500 dark:md:!border-primary-600 font-semibold -mb-px text-primary-600 dark:text-primary-500': activeTab == '{{ inline.opts.verbose_name|slugify }}', 'hover:text-gray-700 dark:hover:text-gray-200 dark:border-gray-800': activeTab != '{{ inline.opts.verbose_name|slugify }}'}">
33
+ x-bind:class="{'border-b border-gray-200 dark:border-gray-800 md:border-primary-500 dark:md:!border-primary-600 font-semibold -mb-px text-primary-600 dark:text-primary-500': activeTab == '{{ inline.opts.verbose_name|slugify }}', 'hover:text-primary-600 dark:hover:text-primary-500 dark:border-gray-800': activeTab != '{{ inline.opts.verbose_name|slugify }}'}">
34
34
  {% if inline.formset.max_num == 1 %}
35
35
  {{ inline.opts.verbose_name|capfirst }}
36
36
  {% else %}
@@ -7,7 +7,7 @@
7
7
  </span>
8
8
  </a>
9
9
 
10
- <nav class="absolute bg-white border flex flex-col leading-none overflow-hidden py-1 -right-2 rounded shadow-lg top-7 w-40 z-50 dark:bg-gray-800 dark:border-gray-700" x-cloak x-show="openTheme" @click.outside="openTheme = false">
10
+ <nav class="absolute bg-white border flex flex-col leading-none py-1 -right-2 rounded shadow-lg top-7 w-40 z-50 dark:bg-gray-800 dark:border-gray-700" x-cloak x-show="openTheme" @click.outside="openTheme = false">
11
11
  <a class="cursor-pointer flex flex-row leading-none mx-1 px-3 py-1.5 rounded hover:bg-gray-100 hover:text-gray-700 dark:hover:bg-gray-700 dark:hover:text-gray-200"
12
12
  x-on:click="adminTheme = 'dark'"
13
13
  x-bind:class="adminTheme == 'dark' && 'text-primary-600 dark:text-primary-500 dark:hover:!text-primary-500 hover:!text-primary-600'">
@@ -7,6 +7,10 @@
7
7
  {% include "unfold/helpers/label.html" with text=environment.0 type=environment.1 %}
8
8
  {% endif %}
9
9
 
10
+ {% if show_languages %}
11
+ {% include "unfold/helpers/language_switch.html" %}
12
+ {% endif %}
13
+
10
14
  {% if not theme %}
11
15
  {% include "unfold/helpers/theme_switch.html" %}
12
16
  {% endif %}
@@ -21,7 +21,7 @@
21
21
  {% endspaceless %}
22
22
  {% endif %}
23
23
 
24
- <div class="px-4 lg:px-12">
24
+ <div class="px-4 lg:px-8">
25
25
  <div id="content" class="container mx-auto {% block coltype %}colM{% endblock %}">
26
26
  {% block content %}
27
27
  {% block object-tools %}{% endblock %}
@@ -0,0 +1,3 @@
1
+ {% for key, value in params.items %}
2
+ <input type="hidden" name="{{ key }}" value="{{ value }}">
3
+ {% endfor %}
@@ -1,4 +1,4 @@
1
- <div class="datetime flex flex-col max-w-2xl">
1
+ <div class="datetime flex flex-col max-w-2xl w-full">
2
2
  <div class="flex flex-col flex-wrap mb-2">
3
3
  {% if date_label %}
4
4
  <div class="mb-2">
@@ -1,9 +1,11 @@
1
- from typing import Any, Dict, List, Mapping, Optional, Union
1
+ from typing import Any, Dict, List, Mapping, Optional, Set, Union
2
2
 
3
3
  from django import template
4
4
  from django.contrib.admin.helpers import AdminForm, Fieldset
5
+ from django.contrib.admin.views.main import ChangeList
5
6
  from django.forms import Field
6
- from django.template import Library, Node, RequestContext, TemplateSyntaxError
7
+ from django.http import HttpRequest
8
+ from django.template import Context, Library, Node, RequestContext, TemplateSyntaxError
7
9
  from django.template.base import NodeList, Parser, Token, token_kwargs
8
10
  from django.template.loader import render_to_string
9
11
  from django.utils.safestring import SafeText
@@ -224,3 +226,28 @@ def add_css_class(field: Field, classes: Union[list, tuple]) -> Field:
224
226
  field.field.widget.attrs["class"] = classes
225
227
 
226
228
  return field
229
+
230
+
231
+ @register.inclusion_tag(
232
+ "unfold/templatetags/preserve_changelist_filters.html",
233
+ takes_context=True,
234
+ name="preserve_filters",
235
+ )
236
+ def preserve_changelist_filters(context: Context) -> Dict[str, Dict[str, str]]:
237
+ """
238
+ Generate hidden input fields to preserve filters for POST forms.
239
+ """
240
+ request: Optional[HttpRequest] = context.get("request")
241
+ changelist: Optional[ChangeList] = context.get("cl")
242
+
243
+ if not request or not changelist:
244
+ return {"params": {}}
245
+
246
+ used_params: Set[str] = {
247
+ param for spec in changelist.filter_specs for param in spec.used_parameters
248
+ }
249
+ preserved_params: Dict[str, str] = {
250
+ param: value for param, value in request.GET.items() if param not in used_params
251
+ }
252
+
253
+ return {"params": preserved_params}
unfold/utils.py CHANGED
@@ -3,6 +3,7 @@ import decimal
3
3
  import json
4
4
  from typing import Any, Iterable, List, Optional
5
5
 
6
+ from django.conf import settings
6
7
  from django.db import models
7
8
  from django.template.loader import render_to_string
8
9
  from django.utils import formats, timezone
@@ -146,3 +147,19 @@ def prettify_json(data: Any) -> Optional[str]:
146
147
  f'<div class="block dark:hidden">{format_response(response, "colorful")}</div>'
147
148
  f'<div class="hidden dark:block">{format_response(response, "monokai")}</div>'
148
149
  )
150
+
151
+
152
+ def parse_date_str(value: str) -> Optional[datetime.date]:
153
+ for format in settings.DATE_INPUT_FORMATS:
154
+ try:
155
+ return datetime.datetime.strptime(value, format).date()
156
+ except (ValueError, TypeError):
157
+ continue
158
+
159
+
160
+ def parse_datetime_str(value: str) -> Optional[datetime.datetime]:
161
+ for format in settings.DATETIME_INPUT_FORMATS:
162
+ try:
163
+ return datetime.datetime.strptime(value, format)
164
+ except (ValueError, TypeError):
165
+ continue
unfold/widgets.py CHANGED
@@ -35,7 +35,7 @@ from .exceptions import UnfoldException
35
35
 
36
36
  LABEL_CLASSES = [
37
37
  "block",
38
- "font-medium",
38
+ "font-semibold",
39
39
  "mb-2",
40
40
  "text-font-important-light",
41
41
  "text-sm",
@@ -43,7 +43,7 @@ LABEL_CLASSES = [
43
43
  ]
44
44
 
45
45
  CHECKBOX_LABEL_CLASSES = [
46
- "font-medium",
46
+ "font-semibold",
47
47
  "ml-2",
48
48
  "text-sm",
49
49
  "text-font-important-light",
@@ -332,6 +332,8 @@ class UnfoldAdminImageSmallFieldWidget(FileFieldMixin, AdminFileWidget):
332
332
 
333
333
 
334
334
  class UnfoldAdminDateWidget(AdminDateWidget):
335
+ template_name = "unfold/widgets/date.html"
336
+
335
337
  def __init__(
336
338
  self, attrs: Optional[Dict[str, Any]] = None, format: Optional[str] = None
337
339
  ) -> None:
@@ -358,6 +360,8 @@ class UnfoldAdminSingleDateWidget(AdminDateWidget):
358
360
 
359
361
 
360
362
  class UnfoldAdminTimeWidget(AdminTimeWidget):
363
+ template_name = "unfold/widgets/time.html"
364
+
361
365
  def __init__(
362
366
  self, attrs: Optional[Dict[str, Any]] = None, format: Optional[str] = None
363
367
  ) -> None: