django-unfold 0.36.0__py3-none-any.whl → 0.38.0__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- django_unfold-0.38.0.dist-info/METADATA +70 -0
- {django_unfold-0.36.0.dist-info → django_unfold-0.38.0.dist-info}/RECORD +75 -74
- unfold/admin.py +2 -1
- unfold/contrib/filters/templates/unfold/filters/filters_date_range.html +1 -1
- unfold/contrib/filters/templates/unfold/filters/filters_datetime_range.html +1 -1
- unfold/contrib/filters/templates/unfold/filters/filters_numeric_range.html +1 -1
- unfold/contrib/filters/templates/unfold/filters/filters_numeric_single.html +1 -1
- unfold/contrib/filters/templates/unfold/filters/filters_numeric_slider.html +4 -4
- unfold/contrib/forms/templates/unfold/forms/helpers/toolbar.html +6 -6
- unfold/contrib/forms/widgets.py +1 -0
- unfold/contrib/guardian/templates/admin/guardian/model/obj_perms_manage_group.html +1 -1
- unfold/contrib/guardian/templates/admin/guardian/model/obj_perms_manage_user.html +1 -1
- unfold/contrib/guardian/templates/unfold/guardian/group_form.html +5 -5
- unfold/contrib/guardian/templates/unfold/guardian/user_form.html +5 -5
- unfold/contrib/import_export/forms.py +1 -0
- unfold/contrib/import_export/templates/admin/import_export/change_form.html +1 -1
- unfold/contrib/import_export/templates/admin/import_export/import.html +13 -13
- unfold/contrib/import_export/templates/admin/import_export/import_errors.html +3 -3
- unfold/contrib/inlines/admin.py +1 -0
- unfold/contrib/simple_history/templates/simple_history/object_history.html +1 -1
- unfold/contrib/simple_history/templates/simple_history/object_history_list.html +8 -8
- unfold/contrib/simple_history/templates/simple_history/submit_line.html +1 -1
- unfold/settings.py +26 -1
- unfold/static/unfold/css/styles.css +1 -1
- unfold/static/unfold/js/app.js +7 -1
- unfold/styles.css +1 -1
- unfold/templates/admin/app_list.html +3 -3
- unfold/templates/admin/auth/user/add_form.html +1 -1
- unfold/templates/admin/base_site.html +1 -1
- unfold/templates/admin/change_form.html +1 -1
- unfold/templates/admin/change_list.html +8 -13
- unfold/templates/admin/change_list_results.html +2 -2
- unfold/templates/admin/delete_confirmation.html +6 -6
- unfold/templates/admin/delete_selected_confirmation.html +5 -5
- unfold/templates/admin/edit_inline/stacked.html +7 -5
- unfold/templates/admin/edit_inline/tabular.html +3 -3
- unfold/templates/admin/filter.html +1 -1
- unfold/templates/admin/includes/fieldset.html +1 -1
- unfold/templates/admin/includes/object_delete_summary.html +1 -1
- unfold/templates/admin/login.html +2 -2
- unfold/templates/admin/nav_sidebar.html +1 -1
- unfold/templates/admin/search_form.html +1 -1
- unfold/templates/auth/widgets/read_only_password_hash.html +2 -2
- unfold/templates/registration/logged_out.html +1 -1
- unfold/templates/registration/password_change_done.html +3 -3
- unfold/templates/unfold/change_list_filter.html +31 -15
- unfold/templates/unfold/components/card.html +1 -1
- unfold/templates/unfold/components/navigation.html +1 -1
- unfold/templates/unfold/components/title.html +1 -1
- unfold/templates/unfold/helpers/actions_row.html +14 -14
- unfold/templates/unfold/helpers/app_list.html +8 -8
- unfold/templates/unfold/helpers/display_header.html +1 -1
- unfold/templates/unfold/helpers/fieldset_row.html +2 -2
- unfold/templates/unfold/helpers/fieldsets_tabs.html +4 -4
- unfold/templates/unfold/helpers/form_label.html +1 -1
- unfold/templates/unfold/helpers/label.html +13 -13
- unfold/templates/unfold/helpers/messages.html +12 -12
- unfold/templates/unfold/helpers/navigation.html +2 -2
- unfold/templates/unfold/helpers/search.html +1 -1
- unfold/templates/unfold/helpers/tab_action.html +1 -1
- unfold/templates/unfold/helpers/tab_list.html +2 -0
- unfold/templates/unfold/helpers/welcomemsg.html +3 -3
- unfold/templates/unfold/layouts/skeleton.html +47 -47
- unfold/templates/unfold/widgets/clearable_file_input.html +2 -2
- unfold/templates/unfold/widgets/clearable_file_input_small.html +10 -2
- unfold/templates/unfold/widgets/foreign_key_raw_id.html +6 -4
- unfold/templates/unfold/widgets/radio_option.html +3 -3
- unfold/templates/unfold/widgets/range.html +8 -8
- unfold/templates/unfold/widgets/related_widget_wrapper.html +6 -6
- unfold/templates/unfold/widgets/url.html +7 -0
- unfold/templatetags/unfold_list.py +0 -7
- unfold/utils.py +6 -1
- unfold/widgets.py +26 -6
- django_unfold-0.36.0.dist-info/METADATA +0 -1455
- {django_unfold-0.36.0.dist-info → django_unfold-0.38.0.dist-info}/LICENSE.md +0 -0
- {django_unfold-0.36.0.dist-info → django_unfold-0.38.0.dist-info}/WHEEL +0 -0
@@ -14,7 +14,7 @@
|
|
14
14
|
hx-trigger="keyup changed delay:500ms, search"
|
15
15
|
hx-target="#search-results"
|
16
16
|
hx-indicator=".htmx-indicator"
|
17
|
-
class="flex-grow font-medium overflow-hidden pl-2 pr-3 py-2 text-
|
17
|
+
class="flex-grow font-medium overflow-hidden pl-2 pr-3 py-2 text-font-default-light text-sm focus:outline-none dark:bg-gray-900 dark:text-font-default-dark"
|
18
18
|
placeholder="{% translate 'Search apps and models...' %}" aria-label="{% translate 'Filter navigation items' %}" />
|
19
19
|
<div class="absolute opacity-0 htmx-indicator mt-0.5 right-2 top-2">
|
20
20
|
<span class="animate-spin material-symbols-outlined md-18 text-gray-300">sync</span>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<li class="border-b flex-grow text-center md:border-b-0 md:border-r last:border-0 dark:border-gray-800">
|
2
|
-
<a href="{{ link }}" class="block px-4 py-2 text-left whitespace-nowrap
|
2
|
+
<a href="{{ link }}" class="block px-4 py-2 text-left whitespace-nowrap"{% if blank %} target="_blank"{% endif %} {% include "unfold/helpers/attrs.html" with attrs=action.attrs %}>
|
3
3
|
{{ title }}
|
4
4
|
</a>
|
5
5
|
</li>
|
@@ -18,6 +18,7 @@
|
|
18
18
|
{% if inlines_list %}
|
19
19
|
<li class="border-b last:border-b-0 md:border-b-0 md:mr-8 dark:border-gray-800">
|
20
20
|
<a class="block cursor-pointer font-medium px-3 py-2 md:py-4 md:px-0"
|
21
|
+
href="#general"
|
21
22
|
x-on:click="activeTab = 'general'"
|
22
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
24
|
{% trans "General" %}
|
@@ -27,6 +28,7 @@
|
|
27
28
|
{% for inline in inlines_list %}
|
28
29
|
<li class="border-b last:border-b-0 md:border-b-0 md:mr-8 dark:border-gray-800">
|
29
30
|
<a class="block cursor-pointer font-medium px-3 py-2 md:py-4 md:px-0"
|
31
|
+
href="#{{ inline.opts.verbose_name|slugify }}"
|
30
32
|
x-on:click="activeTab = '{{ inline.opts.verbose_name|slugify }}'"
|
31
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 }}'}">
|
32
34
|
{% if inline.formset.max_num == 1 %}
|
@@ -1,9 +1,9 @@
|
|
1
1
|
{% load i18n %}
|
2
2
|
|
3
|
-
<div class="flex-grow font-
|
4
|
-
<h1 class="overflow-hidden text-ellipsis text-sm whitespace-nowrap xl:text-base text-
|
3
|
+
<div class="flex-grow font-semibold min-w-0 mr-3">
|
4
|
+
<h1 class="overflow-hidden text-ellipsis text-sm whitespace-nowrap xl:text-base text-font-important-light dark:text-font-important-dark">
|
5
5
|
{% if content_title %}
|
6
|
-
<span class="
|
6
|
+
<span class="tracking-tight">
|
7
7
|
{{ pretitle }}
|
8
8
|
|
9
9
|
{{ content_title }}
|
@@ -14,65 +14,65 @@
|
|
14
14
|
<!DOCTYPE html>
|
15
15
|
<html lang="{{ LANGUAGE_CODE|default:"en-us" }}" dir="{{ LANGUAGE_BIDI|yesno:"rtl,ltr,auto" }}" {% if theme %}class="{{ theme }}"{% else %}x-data="{ adminTheme: $persist('auto').as('adminTheme') }" x-bind:class="{'dark': adminTheme === 'dark' || (adminTheme === 'auto' && window.matchMedia('(prefers-color-scheme: dark)').matches)}" x-cloak{% endif %}>
|
16
16
|
|
17
|
-
<head>
|
18
|
-
|
17
|
+
<head>
|
18
|
+
<title>{% block title %}{% endblock %}</title>
|
19
19
|
|
20
|
-
|
21
|
-
|
20
|
+
<link href="{% static "unfold/fonts/inter/styles.css" %}" rel="stylesheet">
|
21
|
+
<link href="{% static "unfold/fonts/material-symbols/styles.css" %}" rel="stylesheet">
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
{% for style in styles %}
|
24
|
+
<link href="{{ style }}" rel="stylesheet">
|
25
|
+
{% endfor %}
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
27
|
+
{% for favicon in site_favicons %}
|
28
|
+
<link {% if favicon.rel %}rel="{{ favicon.rel }}"{% endif %} {% if favicon.href %}href="{{ favicon.href }}"{% endif %} {% if favicon.type %}type="{{ favicon.type }}"{% endif %} {% if favicon.sizes %}sizes="{{ favicon.sizes }}"{% endif %}>
|
29
|
+
{% endfor %}
|
30
30
|
|
31
|
-
|
32
|
-
|
31
|
+
<link href="{% static 'unfold/css/styles.css' %}" rel="stylesheet">
|
32
|
+
<link href="{% static 'unfold/css/simplebar.css' %}" rel="stylesheet">
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
34
|
+
<script src="{% static 'unfold/js/alpine.anchor.js' %}" defer></script>
|
35
|
+
<script src="{% static 'unfold/js/alpine.persist.js' %}" defer></script>
|
36
|
+
<script src="{% static 'unfold/js/alpine.js' %}" defer></script>
|
37
|
+
<script src="{% static 'unfold/js/htmx.js' %}"></script>
|
38
|
+
<script src="{% static 'unfold/js/chart.js' %}"></script>
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
|
40
|
+
{% for script in scripts %}
|
41
|
+
<script src="{{ script }}"></script>
|
42
|
+
{% endfor %}
|
43
43
|
|
44
|
-
|
44
|
+
{% block extrastyle %}{% endblock %}
|
45
45
|
|
46
|
-
|
46
|
+
{% block extrahead %}{% endblock %}
|
47
47
|
|
48
|
-
|
48
|
+
<script src="{% static 'unfold/js/app.js' %}"></script>
|
49
49
|
|
50
|
-
|
51
|
-
|
52
|
-
|
50
|
+
{% block responsive %}
|
51
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
52
|
+
{% endblock %}
|
53
53
|
|
54
|
-
|
55
|
-
|
56
|
-
|
54
|
+
{% block blockbots %}
|
55
|
+
<meta name="robots" content="NONE,NOARCHIVE">
|
56
|
+
{% endblock %}
|
57
57
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
58
|
+
{% if colors %}
|
59
|
+
<style>
|
60
|
+
html {
|
61
|
+
{% for name, weights in colors.items %}
|
62
|
+
{% for weight, value in weights.items %}
|
63
|
+
--color-{{ name }}-{{ weight }}: {{ value }};
|
64
|
+
{% endfor %}
|
64
65
|
{% endfor %}
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
</body>
|
66
|
+
}
|
67
|
+
</style>
|
68
|
+
{% endif %}
|
69
|
+
</head>
|
70
|
+
|
71
|
+
<body class="antialiased bg-white font-sans text-font-default-light text-sm dark:bg-gray-900 dark:text-font-default-dark {% if is_popup %}popup {% endif %}{% block bodyclass %}{% endblock %}" data-admin-utc-offset="{% now "Z" %}" x-data="{ activeTab: 'general', sidebarMobileOpen: false, sidebarDesktopOpen: {% if request.session.toggle_sidebar == False %}false{% else %}true{% endif %} }" x-init="activeTab = window.location.hash?.replace('#', '') || 'general'">
|
72
|
+
{% block base %}{% endblock %}
|
73
|
+
|
74
|
+
<div id="modal-overlay" class="backdrop-blur-sm bg-opacity-80 bg-gray-900 bottom-0 fixed hidden left-0 mr-1 right-0 top-0 z-50"></div>
|
75
|
+
<script src="{% static 'unfold/js/simplebar.js' %}"></script>
|
76
|
+
</body>
|
77
77
|
|
78
78
|
</html>
|
@@ -10,7 +10,7 @@
|
|
10
10
|
|
11
11
|
<div class="border flex items-center overflow-hidden rounded-md shadow-sm text-sm max-w-2xl dark:border-gray-700">
|
12
12
|
{% if widget.is_initial and not widget.required %}
|
13
|
-
<div class="bg-gray-50 border-r flex flex-none items-center self-stretch px-3 dark:bg-white/[.02] dark:border-gray-700 dark:text-
|
13
|
+
<div class="bg-gray-50 border-r flex flex-none items-center self-stretch px-3 dark:bg-white/[.02] dark:border-gray-700 dark:text-font-default-dark">
|
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
|
|
@@ -21,7 +21,7 @@
|
|
21
21
|
</div>
|
22
22
|
{% endif %}
|
23
23
|
|
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
|
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">
|
25
25
|
|
26
26
|
<div class="flex flex-none items-center leading-none self-stretch">
|
27
27
|
<div class="hidden">
|
@@ -14,10 +14,18 @@
|
|
14
14
|
</div>
|
15
15
|
{% endif %}
|
16
16
|
|
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
|
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">
|
18
18
|
|
19
19
|
<div class="flex flex-none items-center leading-none self-stretch">
|
20
|
-
<
|
20
|
+
<div class="hidden">
|
21
|
+
<input type="{{ widget.type }}" name="{{ widget.name }}" {% include "django/forms/widgets/attrs.html" %} />
|
22
|
+
</div>
|
23
|
+
|
24
|
+
{% if widget.is_initial %}
|
25
|
+
<a href="{{ widget.value.url }}" class="border-r cursor-pointer text-gray-400 px-3 hover:text-gray-700 dark:border-gray-700 dark:text-gray-500 dark:hover:text-gray-200" target="_blank">
|
26
|
+
<span class="material-symbols-outlined">download</span>
|
27
|
+
</a>
|
28
|
+
{% endif %}
|
21
29
|
|
22
30
|
<label for="{{ widget.attrs.id }}" class="cursor-pointer text-gray-400 px-3 hover:text-gray-700 dark:text-gray-500 dark:hover:text-gray-200">
|
23
31
|
<span class="material-symbols-outlined">file_upload</span>
|
@@ -8,12 +8,14 @@
|
|
8
8
|
{% endif %}
|
9
9
|
|
10
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">
|
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 truncate dark:text-primary-500">
|
12
12
|
{{ link_label }}
|
13
13
|
</a>
|
14
14
|
{% else %}
|
15
|
-
|
16
|
-
{{ link_label }}
|
17
|
-
|
15
|
+
{% if link_label %}
|
16
|
+
<span title="{{ link_label }}" class="flex items-center h-9.5 justify-center ml-4 rounded shrink-0 text-sm truncate">
|
17
|
+
{{ link_label }}
|
18
|
+
</span>
|
19
|
+
{% endif %}
|
18
20
|
{% endif %}
|
19
21
|
</div>
|
@@ -1,11 +1,11 @@
|
|
1
1
|
<div class="flex flex-row items-center max-w-2xl">
|
2
|
-
{% for widget in widget.subwidgets %}
|
3
|
-
|
2
|
+
{% for widget in widget.subwidgets %}
|
3
|
+
{% include widget.template_name %}
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
{% endfor %}
|
5
|
+
{% if forloop.first %}
|
6
|
+
<div class="px-4 text-gray-300">
|
7
|
+
-
|
8
|
+
</div>
|
9
|
+
{% endif %}
|
10
|
+
{% endfor %}
|
11
11
|
</div>
|
@@ -22,8 +22,8 @@
|
|
22
22
|
<a class="related-widget-wrapper-link add-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"
|
23
23
|
data-popup="yes"
|
24
24
|
id="add_id_{{ name }}"
|
25
|
-
|
26
|
-
|
25
|
+
href="{{ add_related_url }}?{{ url_params }}"
|
26
|
+
title="{% blocktranslate %}Add another {{ model }}{% endblocktranslate %}">
|
27
27
|
<span class="material-symbols-outlined text-sm">add</span>
|
28
28
|
</a>
|
29
29
|
{% endif %}
|
@@ -38,11 +38,11 @@
|
|
38
38
|
{% endif %}
|
39
39
|
|
40
40
|
{% if can_delete_related %}
|
41
|
-
|
41
|
+
<a class="related-widget-wrapper-link delete-related 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"
|
42
42
|
id="delete_id_{{ name }}"
|
43
|
-
|
44
|
-
|
45
|
-
|
43
|
+
data-href-template="{{ delete_related_template_url }}?{{ url_params }}"
|
44
|
+
data-popup="yes"
|
45
|
+
title="{% blocktranslate %}Delete selected {{ model }}{% endblocktranslate %}">
|
46
46
|
<span class="material-symbols-outlined text-sm">delete</span>
|
47
47
|
</a>
|
48
48
|
{% endif %}
|
@@ -50,17 +50,13 @@ ROW_CLASSES = [
|
|
50
50
|
"px-3",
|
51
51
|
"py-2",
|
52
52
|
"text-left",
|
53
|
-
"text-sm",
|
54
53
|
"before:flex",
|
55
54
|
"before:capitalize",
|
56
55
|
"before:content-[attr(data-label)]",
|
57
56
|
"before:items-center",
|
58
57
|
"before:font-semibold",
|
59
58
|
"before:mr-auto",
|
60
|
-
"before:text-gray-900",
|
61
59
|
"first:border-t-0",
|
62
|
-
"dark:text-gray-300",
|
63
|
-
"dark:before:text-gray-100",
|
64
60
|
"lg:before:hidden",
|
65
61
|
"lg:first:border-t",
|
66
62
|
"lg:py-3",
|
@@ -76,18 +72,15 @@ CHECKBOX_CLASSES = [
|
|
76
72
|
"px-3",
|
77
73
|
"py-2",
|
78
74
|
"text-left",
|
79
|
-
"text-sm",
|
80
75
|
"before:block",
|
81
76
|
"before:capitalize",
|
82
77
|
"before:content-[attr(data-label)]",
|
83
78
|
"before:font-semibold",
|
84
79
|
"before:mr-auto",
|
85
|
-
"before:text-gray-100",
|
86
80
|
"lg:before:hidden",
|
87
81
|
"lg:border-t",
|
88
82
|
"lg:border-gray-200",
|
89
83
|
"lg:table-cell",
|
90
|
-
"dark:before:text-gray-100",
|
91
84
|
"dark:lg:border-gray-800",
|
92
85
|
]
|
93
86
|
|
unfold/utils.py
CHANGED
@@ -132,7 +132,12 @@ def prettify_json(data: Any) -> Optional[str]:
|
|
132
132
|
return None
|
133
133
|
|
134
134
|
def format_response(response: str, theme: str) -> str:
|
135
|
-
formatter = HtmlFormatter(
|
135
|
+
formatter = HtmlFormatter(
|
136
|
+
style=theme,
|
137
|
+
noclasses=True,
|
138
|
+
nobackground=True,
|
139
|
+
prestyles="white-space: pre-wrap; word-wrap: break-word;",
|
140
|
+
)
|
136
141
|
return highlight(response, JsonLexer(), formatter)
|
137
142
|
|
138
143
|
response = json.dumps(data, sort_keys=True, indent=4)
|
unfold/widgets.py
CHANGED
@@ -13,6 +13,7 @@ from django.contrib.admin.widgets import (
|
|
13
13
|
AdminTextareaWidget,
|
14
14
|
AdminTextInputWidget,
|
15
15
|
AdminTimeWidget,
|
16
|
+
AdminURLFieldWidget,
|
16
17
|
AdminUUIDInputWidget,
|
17
18
|
ForeignKeyRawIdWidget,
|
18
19
|
RelatedFieldWidgetWrapper,
|
@@ -20,6 +21,7 @@ from django.contrib.admin.widgets import (
|
|
20
21
|
from django.db.models.fields.reverse_related import ForeignObjectRel
|
21
22
|
from django.forms import (
|
22
23
|
CheckboxInput,
|
24
|
+
CheckboxSelectMultiple,
|
23
25
|
MultiWidget,
|
24
26
|
NullBooleanSelect,
|
25
27
|
NumberInput,
|
@@ -35,16 +37,17 @@ LABEL_CLASSES = [
|
|
35
37
|
"block",
|
36
38
|
"font-medium",
|
37
39
|
"mb-2",
|
38
|
-
"text-
|
40
|
+
"text-font-important-light",
|
39
41
|
"text-sm",
|
40
|
-
"dark:text-
|
42
|
+
"dark:text-font-important-dark",
|
41
43
|
]
|
42
44
|
|
43
45
|
CHECKBOX_LABEL_CLASSES = [
|
46
|
+
"font-medium",
|
44
47
|
"ml-2",
|
45
48
|
"text-sm",
|
46
|
-
"text-
|
47
|
-
"dark:text-
|
49
|
+
"text-font-important-light",
|
50
|
+
"dark:text-font-important-dark",
|
48
51
|
]
|
49
52
|
|
50
53
|
BASE_CLASSES = [
|
@@ -54,7 +57,7 @@ BASE_CLASSES = [
|
|
54
57
|
"min-w-20",
|
55
58
|
"rounded-md",
|
56
59
|
"shadow-sm",
|
57
|
-
"text-
|
60
|
+
"text-font-default-light",
|
58
61
|
"text-sm",
|
59
62
|
"focus:ring",
|
60
63
|
"focus:ring-primary-300",
|
@@ -64,7 +67,7 @@ BASE_CLASSES = [
|
|
64
67
|
"group-[.errors]:focus:ring-red-200",
|
65
68
|
"dark:bg-gray-900",
|
66
69
|
"dark:border-gray-700",
|
67
|
-
"dark:text-
|
70
|
+
"dark:text-font-default-dark",
|
68
71
|
"dark:focus:border-primary-600",
|
69
72
|
"dark:focus:ring-primary-700",
|
70
73
|
"dark:focus:ring-opacity-50",
|
@@ -253,6 +256,13 @@ class UnfoldAdminTextInputWidget(AdminTextInputWidget):
|
|
253
256
|
super().__init__(attrs={"class": " ".join(INPUT_CLASSES), **(attrs or {})})
|
254
257
|
|
255
258
|
|
259
|
+
class UnfoldAdminURLInputWidget(AdminURLFieldWidget):
|
260
|
+
template_name = "unfold/widgets/url.html"
|
261
|
+
|
262
|
+
def __init__(self, attrs: Optional[Dict[str, Any]] = None) -> None:
|
263
|
+
super().__init__(attrs={"class": " ".join(INPUT_CLASSES), **(attrs or {})})
|
264
|
+
|
265
|
+
|
256
266
|
class UnfoldAdminColorInputWidget(AdminTextInputWidget):
|
257
267
|
def __init__(self, attrs: Optional[Dict[str, Any]] = None) -> None:
|
258
268
|
super().__init__(
|
@@ -513,6 +523,16 @@ class UnfoldAdminRadioSelectWidget(AdminRadioSelect):
|
|
513
523
|
return context
|
514
524
|
|
515
525
|
|
526
|
+
class UnfoldAdminCheckboxSelectMultiple(CheckboxSelectMultiple):
|
527
|
+
template_name = "unfold/widgets/radio.html"
|
528
|
+
option_template_name = "unfold/widgets/radio_option.html"
|
529
|
+
|
530
|
+
def __init__(self, *args, **kwargs):
|
531
|
+
super().__init__(*args, **kwargs)
|
532
|
+
|
533
|
+
self.attrs = {"class": " ".join(CHECKBOX_CLASSES)}
|
534
|
+
|
535
|
+
|
516
536
|
try:
|
517
537
|
from djmoney.forms.widgets import MoneyWidget
|
518
538
|
from djmoney.settings import CURRENCY_CHOICES
|