django-unfold 0.12.0__py3-none-any.whl → 0.13.0__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. {django_unfold-0.12.0.dist-info → django_unfold-0.13.0.dist-info}/METADATA +209 -102
  2. {django_unfold-0.12.0.dist-info → django_unfold-0.13.0.dist-info}/RECORD +32 -13
  3. unfold/admin.py +26 -6
  4. unfold/contrib/guardian/__init__.py +0 -0
  5. unfold/contrib/guardian/apps.py +6 -0
  6. unfold/contrib/guardian/templates/admin/guardian/model/change_form.html +13 -0
  7. unfold/contrib/guardian/templates/admin/guardian/model/field.html +11 -0
  8. unfold/contrib/guardian/templates/admin/guardian/model/obj_perms_manage.html +35 -0
  9. unfold/contrib/guardian/templates/admin/guardian/model/obj_perms_manage_group.html +55 -0
  10. unfold/contrib/guardian/templates/admin/guardian/model/obj_perms_manage_user.html +56 -0
  11. unfold/contrib/guardian/templates/unfold/guardian/group_form.html +72 -0
  12. unfold/contrib/guardian/templates/unfold/guardian/user_form.html +72 -0
  13. unfold/contrib/simple_history/__init__.py +0 -0
  14. unfold/contrib/simple_history/apps.py +6 -0
  15. unfold/contrib/simple_history/templates/simple_history/_object_history_list.html +80 -0
  16. unfold/contrib/simple_history/templates/simple_history/object_history.html +21 -0
  17. unfold/contrib/simple_history/templates/simple_history/object_history_form.html +55 -0
  18. unfold/contrib/simple_history/templates/simple_history/submit_line.html +25 -0
  19. unfold/settings.py +1 -0
  20. unfold/sites.py +4 -0
  21. unfold/static/unfold/css/styles.css +1 -1
  22. unfold/styles.css +134 -66
  23. unfold/templates/admin/edit_inline/tabular.html +1 -1
  24. unfold/templates/admin/includes/fieldset.html +3 -7
  25. unfold/templates/admin/widgets/radio.html +20 -0
  26. unfold/templates/admin/widgets/radio_option.html +12 -0
  27. unfold/templates/unfold/helpers/field_readonly.html +9 -0
  28. unfold/templates/unfold/helpers/submit.html +3 -0
  29. unfold/templatetags/unfold.py +14 -0
  30. unfold/widgets.py +19 -0
  31. /django_unfold-0.12.0.dist-info/LICENSE → /django_unfold-0.13.0.dist-info/LICENSE.md +0 -0
  32. {django_unfold-0.12.0.dist-info → django_unfold-0.13.0.dist-info}/WHEEL +0 -0
@@ -0,0 +1,13 @@
1
+ {% extends "admin/change_form.html" %}
2
+
3
+ {% load i18n admin_urls %}
4
+
5
+ {% block object-tools-items %}
6
+ {% url opts|admin_urlname:'permissions' original.pk|admin_urlquote as history_url %}
7
+
8
+ <a href="{% add_preserved_filters history_url %}" class="permissionslink mx-1 px-3 py-2 rounded-md transition-all hover:bg-gray-100 hover:text-gray-700 dark:hover:bg-gray-700 dark:hover:text-gray-200">
9
+ {% trans "Object permissions" %}
10
+ </a>
11
+
12
+ {{ block.super }}
13
+ {% endblock %}
@@ -0,0 +1,11 @@
1
+ {% load unfold %}
2
+
3
+ {% if field.is_checkbox %}
4
+ {{ field }}
5
+
6
+ <label for="{{ field.auto_id }}" class="required vCheckboxLabel">
7
+ {{ field.label }}
8
+ </label>
9
+ {% else %}
10
+ {% include "unfold/helpers/field.html" with field=field|add_css_class:form_classes.text_input %}
11
+ {% endif %}
@@ -0,0 +1,35 @@
1
+ {% extends "admin/change_form.html" %}
2
+
3
+ {% load admin_urls i18n guardian_tags %}
4
+
5
+ {% block breadcrumbs %}{% if not is_popup %}
6
+ <div class="px-4 lg:px-12">
7
+ <div class="container mb-6 mx-auto -my-3 lg:mb-12">
8
+ <ul class="flex">
9
+ {% url 'admin:index' as link %}
10
+ {% trans 'Home' as name %}
11
+ {% include 'unfold/helpers/breadcrumb_item.html' with link=link name=name %}
12
+
13
+ {% url 'admin:app_list' app_label=opts.app_label as link %}
14
+ {% include 'unfold/helpers/breadcrumb_item.html' with link=link name=opts.app_config.verbose_name %}
15
+
16
+ {% url opts|admin_urlname:'changelist' as link %}
17
+ {% include 'unfold/helpers/breadcrumb_item.html' with link=link name=opts.verbose_name_plural|capfirst %}
18
+
19
+ {% url opts|admin_urlname:'change' object.pk|admin_urlquote as link %}
20
+ {% include 'unfold/helpers/breadcrumb_item.html' with link=link name=original|truncatewords:'18' %}
21
+
22
+ {% trans 'Object permissions' as name %}
23
+ {% include 'unfold/helpers/breadcrumb_item.html' with link='' name=name %}
24
+ </ul>
25
+ </div>
26
+ </div>
27
+ {% endif %}{% endblock %}
28
+
29
+ {% block content %}
30
+ {% include "unfold/guardian/user_form.html" %}
31
+
32
+ <hr class="my-12 dark:border-gray-800"/>
33
+
34
+ {% include "unfold/guardian/group_form.html" %}
35
+ {% endblock %}
@@ -0,0 +1,55 @@
1
+ {% extends "admin/change_form.html" %}
2
+ {% load admin_urls i18n %}
3
+
4
+ {% block extrahead %}{{ block.super }}
5
+ {{ form.media }}
6
+ {% endblock %}
7
+
8
+ {% block breadcrumbs %}{% if not is_popup %}
9
+ <div class="px-4 lg:px-12">
10
+ <div class="container mb-6 mx-auto -my-3 lg:mb-12">
11
+ <ul class="flex">
12
+ {% url 'admin:index' as link %}
13
+ {% trans 'Home' as name %}
14
+ {% include 'unfold/helpers/breadcrumb_item.html' with link=link name=name %}
15
+
16
+ {% url 'admin:app_list' app_label=opts.app_label as link %}
17
+ {% include 'unfold/helpers/breadcrumb_item.html' with link=link name=opts.app_config.verbose_name %}
18
+
19
+ {% url opts|admin_urlname:'changelist' as link %}
20
+ {% include 'unfold/helpers/breadcrumb_item.html' with link=link name=opts.verbose_name_plural|capfirst %}
21
+
22
+ {% url opts|admin_urlname:'change' object.pk|admin_urlquote as link %}
23
+ {% include 'unfold/helpers/breadcrumb_item.html' with link=link name=original|truncatewords:'18' %}
24
+
25
+ {% trans 'Object permissions' as name %}
26
+ {% include 'unfold/helpers/breadcrumb_item.html' with link="../../" name=name %}
27
+
28
+ {% include 'unfold/helpers/breadcrumb_item.html' with link='' name=group_obj|truncatewords:"18" %}
29
+ </ul>
30
+ </div>
31
+ </div>
32
+ {% endif %}{% endblock %}
33
+
34
+ {% block content %}
35
+ <div class="border border-gray-200 overflow-hidden rounded-md p-3 shadow-sm dark:border-gray-800">
36
+ <form method="post">
37
+ {% csrf_token %}
38
+
39
+ {% trans "Object" as title %}
40
+ {% include "unfold/helpers/field_readonly.html" with title=title value=object %}
41
+
42
+ {% trans "Group" as title %}
43
+ {% include "unfold/helpers/field_readonly.html" with title=title value=group_obj %}
44
+
45
+ {% include "unfold/helpers/field.html" with field=form.permissions %}
46
+
47
+ <div class="bg-gray-50 border-t flex flex-row -m-3 p-3 dark:bg-white/[.02] dark:border-gray-800">
48
+ <div class="ml-auto">
49
+ {% trans "Save" as title %}
50
+ {% include "unfold/helpers/submit.html" with title=title %}
51
+ </div>
52
+ </div>
53
+ </form>
54
+ </div>
55
+ {% endblock %}
@@ -0,0 +1,56 @@
1
+ {% extends "admin/change_form.html" %}
2
+
3
+ {% load admin_urls i18n %}
4
+
5
+ {% block extrahead %}{{ block.super }}
6
+ {{ form.media }}
7
+ {% endblock %}
8
+
9
+ {% block breadcrumbs %}{% if not is_popup %}
10
+ <div class="px-4 lg:px-12">
11
+ <div class="container mb-6 mx-auto -my-3 lg:mb-12">
12
+ <ul class="flex">
13
+ {% url 'admin:index' as link %}
14
+ {% trans 'Home' as name %}
15
+ {% include 'unfold/helpers/breadcrumb_item.html' with link=link name=name %}
16
+
17
+ {% url 'admin:app_list' app_label=opts.app_label as link %}
18
+ {% include 'unfold/helpers/breadcrumb_item.html' with link=link name=opts.app_config.verbose_name %}
19
+
20
+ {% url opts|admin_urlname:'changelist' as link %}
21
+ {% include 'unfold/helpers/breadcrumb_item.html' with link=link name=opts.verbose_name_plural|capfirst %}
22
+
23
+ {% url opts|admin_urlname:'change' object.pk|admin_urlquote as link %}
24
+ {% include 'unfold/helpers/breadcrumb_item.html' with link=link name=original|truncatewords:'18' %}
25
+
26
+ {% trans 'Object permissions' as name %}
27
+ {% include 'unfold/helpers/breadcrumb_item.html' with link="../../" name=name %}
28
+
29
+ {% include 'unfold/helpers/breadcrumb_item.html' with link='' name=user_obj|truncatewords:"18" %}
30
+ </ul>
31
+ </div>
32
+ </div>
33
+ {% endif %}{% endblock %}
34
+
35
+ {% block content %}
36
+ <div class="border border-gray-200 overflow-hidden rounded-md p-3 shadow-sm dark:border-gray-800">
37
+ <form method="post">
38
+ {% csrf_token %}
39
+
40
+ {% trans "Object" as title %}
41
+ {% include "unfold/helpers/field_readonly.html" with title=title value=object %}
42
+
43
+ {% trans "User" as title %}
44
+ {% include "unfold/helpers/field_readonly.html" with title=title value=user_obj %}
45
+
46
+ {% include "unfold/helpers/field.html" with field=form.permissions %}
47
+
48
+ <div class="bg-gray-50 border-t flex flex-row -m-3 p-3 dark:bg-white/[.02] dark:border-gray-800">
49
+ <div class="ml-auto">
50
+ {% trans "Save" as title %}
51
+ {% include "unfold/helpers/submit.html" with title=title %}
52
+ </div>
53
+ </div>
54
+ </form>
55
+ </div>
56
+ {% endblock %}
@@ -0,0 +1,72 @@
1
+ {% load i18n %}
2
+
3
+ <form method="post">
4
+ {% csrf_token %}
5
+
6
+ <h2 class="font-medium mb-3 text-sm text-gray-700 dark:text-gray-200">
7
+ {% trans "Group permissions" %}
8
+ </h2>
9
+
10
+ {% if groups_perms.items %}
11
+ <table id="group-permissions" class="border-gray-200 border-spacing-none border-separate mb-6 text-gray-700 w-full dark:text-gray-400 lg:border lg:rounded-md lg:shadow-sm lg:dark:border-gray-800">
12
+ <thead class="hidden lg:table-header-group">
13
+ <tr>
14
+ <th class="align-middle font-medium px-3 py-2 text-left text-gray-400 text-sm">
15
+ {% trans "Group" %}
16
+ </th>
17
+
18
+ {% for perm in model_perms %}
19
+ <th class="align-middle font-medium px-3 py-2 text-left text-gray-400 text-sm">
20
+ {{ perm.name }}
21
+ </th>
22
+ {% endfor %}
23
+
24
+ <th class="align-middle font-medium px-3 py-2 text-right text-gray-400 text-sm">
25
+ {% trans "Action" %}
26
+ </th>
27
+ </tr>
28
+ </thead>
29
+
30
+ <tbody>
31
+ {% for group, group_perms in groups_perms.items %}
32
+ <tr class="block border mb-3 rounded-md shadow-sm lg:table-row lg:border-none lg:mb-0 lg:shadow-none dark:border-gray-800">
33
+ <th class="align-middle flex border-t border-gray-200 font-normal px-3 py-2 text-left text-sm before:flex before:capitalize before:content-[attr(data-label)] before:items-center before:mr-auto before:text-gray-500 first:border-t-0 dark:before:text-gray-400 lg:before:hidden lg:first:border-t lg:py-3 lg:table-cell dark:border-gray-800" data-label="{% trans "User" %}">
34
+ <span class="text-gray-700 dark:text-gray-200">
35
+ {{ group }}
36
+ </span>
37
+ </th>
38
+
39
+ {% for perm in model_perms %}
40
+ <td class="align-middle flex border-t border-gray-200 font-normal px-3 py-2 text-left text-sm before:flex before:capitalize before:content-[attr(data-label)] before:items-center before:mr-auto before:text-gray-500 first:border-t-0 dark:before:text-gray-400 lg:before:hidden lg:first:border-t lg:py-3 lg:table-cell dark:border-gray-800" data-label="{{ perm.name }}">
41
+ {% if perm.codename in group_perms %}
42
+ {% include "unfold/helpers/boolean.html" with value=False %}
43
+ {% else %}
44
+ {% include "unfold/helpers/boolean.html" with value=True %}
45
+ {% endif %}
46
+ </td>
47
+ {% endfor %}
48
+
49
+ <td class="align-middle flex border-t border-gray-200 font-normal px-3 py-2 text-right text-sm before:flex before:capitalize before:content-[attr(data-label)] before:items-center before:mr-auto before:text-gray-500 first:border-t-0 dark:before:text-gray-400 lg:before:hidden lg:first:border-t lg:py-3 lg:table-cell dark:border-gray-800" data-label="{% trans "Action" %}">
50
+ <a href="group-manage/{{ group.id|safe }}/" class="hover:text-gray-700 dark:hover:text-white">
51
+ {% trans "Edit" %}
52
+ </a>
53
+ </td>
54
+ </tr>
55
+ {% endfor %}
56
+ </tbody>
57
+ </table>
58
+ {% endif %}
59
+
60
+ <div class="border border-gray-200 overflow-hidden rounded-md p-3 shadow-sm dark:border-gray-800">
61
+ {% for field in group_form %}
62
+ {% include "admin/guardian/model/field.html" %}
63
+ {% endfor %}
64
+
65
+ <div class="bg-gray-50 border-t flex flex-row -m-3 p-3 dark:bg-white/[.02] dark:border-gray-800">
66
+ <div class="ml-auto">
67
+ {% trans "Manage group" as title %}
68
+ {% include "unfold/helpers/submit.html" with title=title name="submit_manage_group" %}
69
+ </div>
70
+ </div>
71
+ </div>
72
+ </form>
@@ -0,0 +1,72 @@
1
+ {% load i18n %}
2
+
3
+ <form method="post">
4
+ {% csrf_token %}
5
+
6
+ <h2 class="font-medium mb-3 text-sm text-gray-700 dark:text-gray-200">
7
+ {% trans "User permissions" %}
8
+ </h2>
9
+
10
+ {% if users_perms.items %}
11
+ <table id="user-permissions" class="border-gray-200 border-spacing-none border-separate mb-6 text-gray-700 w-full dark:text-gray-400 lg:border lg:rounded-md lg:shadow-sm lg:dark:border-gray-800">
12
+ <thead class="hidden lg:table-header-group">
13
+ <tr>
14
+ <th class="align-middle font-medium px-3 py-2 text-left text-gray-400 text-sm">
15
+ {% trans "User" %}
16
+ </th>
17
+
18
+ {% for perm in model_perms %}
19
+ <th class="align-middle font-medium px-3 py-2 text-left text-gray-400 text-sm">
20
+ {{ perm.name }}
21
+ </th>
22
+ {% endfor %}
23
+
24
+ <th class="align-middle font-medium px-3 py-2 text-right text-gray-400 text-sm">
25
+ {% trans "Action" %}
26
+ </th>
27
+ </tr>
28
+ </thead>
29
+
30
+ <tbody>
31
+ {% for user, user_perms in users_perms.items %}
32
+ <tr class="block border mb-3 rounded-md shadow-sm lg:table-row lg:border-none lg:mb-0 lg:shadow-none dark:border-gray-800">
33
+ <th class="align-middle flex border-t border-gray-200 font-normal px-3 py-2 text-left text-sm before:flex before:capitalize before:content-[attr(data-label)] before:items-center before:mr-auto before:text-gray-500 first:border-t-0 dark:before:text-gray-400 lg:before:hidden lg:first:border-t lg:py-3 lg:table-cell dark:border-gray-800" data-label="{% trans "User" %}">
34
+ <span class="text-gray-700 dark:text-gray-200">
35
+ {{ user }}
36
+ </span>
37
+ </th>
38
+
39
+ {% for perm in model_perms %}
40
+ <td class="align-middle flex border-t border-gray-200 font-normal px-3 py-2 text-left text-sm before:flex before:capitalize before:content-[attr(data-label)] before:items-center before:mr-auto before:text-gray-500 first:border-t-0 dark:before:text-gray-400 lg:before:hidden lg:first:border-t lg:py-3 lg:table-cell dark:border-gray-800" data-label="{{ perm.name }}">
41
+ {% if perm.codename in group_perms %}
42
+ {% include "unfold/helpers/boolean.html" with value=False %}
43
+ {% else %}
44
+ {% include "unfold/helpers/boolean.html" with value=True %}
45
+ {% endif %}
46
+ </td>
47
+ {% endfor %}
48
+
49
+ <td class="align-middle flex border-t border-gray-200 font-normal px-3 py-2 text-right text-sm before:flex before:capitalize before:content-[attr(data-label)] before:items-center before:mr-auto before:text-gray-500 first:border-t-0 dark:before:text-gray-400 lg:before:hidden lg:first:border-t lg:py-3 lg:table-cell dark:border-gray-800" data-label="{% trans "Action" %}">
50
+ <a href="user-manage/{{ user.id|safe }}/" class="hover:text-gray-700 dark:hover:text-white">
51
+ {% trans "Edit" %}
52
+ </a>
53
+ </td>
54
+ </tr>
55
+ {% endfor %}
56
+ </tbody>
57
+ </table>
58
+ {% endif %}
59
+
60
+ <div class="border border-gray-200 overflow-hidden rounded-md p-3 shadow-sm dark:border-gray-800">
61
+ {% for field in user_form %}
62
+ {% include "admin/guardian/model/field.html" %}
63
+ {% endfor %}
64
+
65
+ <div class="bg-gray-50 border-t flex flex-row -m-3 p-3 dark:bg-white/[.02] dark:border-gray-800">
66
+ <div class="ml-auto">
67
+ {% trans "Manage user" as title %}
68
+ {% include "unfold/helpers/submit.html" with title=title name="submit_manage_user" %}
69
+ </div>
70
+ </div>
71
+ </div>
72
+ </form>
File without changes
@@ -0,0 +1,6 @@
1
+ from django.apps import AppConfig
2
+
3
+
4
+ class SimpleHistoryConfig(AppConfig):
5
+ name = "unfold.contrib.simple_history"
6
+ label = "unfold_simple_history"
@@ -0,0 +1,80 @@
1
+ {% load i18n %}
2
+ {% load url from simple_history_compat %}
3
+ {% load admin_urls %}
4
+ {% load getattribute from getattributes %}
5
+
6
+ <table id="change-history" class="border-gray-200 border-spacing-none border-separate mb-6 text-gray-700 w-full dark:text-gray-400 lg:border lg:rounded-md lg:shadow-sm lg:dark:border-gray-800">
7
+ <thead class="hidden lg:table-header-group">
8
+ <tr>
9
+ <th class="align-middle font-medium px-3 py-2 text-left text-gray-400 text-sm">
10
+ {% trans 'Object' %}
11
+ </th>
12
+
13
+ {% for column in history_list_display %}
14
+ <th class="align-middle font-medium px-3 py-2 text-left text-gray-400 text-sm">
15
+ {% trans column %}
16
+ </th>
17
+ {% endfor %}
18
+
19
+ <th class="align-middle font-medium px-3 py-2 text-left text-gray-400 text-sm">
20
+ {% trans 'Date/time' %}
21
+ </th>
22
+
23
+ <th class="align-middle font-medium px-3 py-2 text-left text-gray-400 text-sm">
24
+ {% trans 'Comment' %}
25
+ </th>
26
+
27
+ <th class="align-middle font-medium px-3 py-2 text-left text-gray-400 text-sm">
28
+ {% trans 'Changed by' %}
29
+ </th>
30
+
31
+ <th class="align-middle font-medium px-3 py-2 text-left text-gray-400 text-sm">
32
+ {% trans 'Change reason' %}
33
+ </th>
34
+ </tr>
35
+ </thead>
36
+
37
+ <tbody>
38
+ {% for action in action_list %}
39
+ <tr class="block border mb-3 rounded-md shadow-sm lg:table-row lg:border-none lg:mb-0 lg:shadow-none dark:border-gray-800">
40
+ <td class="align-middle flex border-t border-gray-200 font-normal px-3 py-2 text-left text-sm before:flex before:capitalize before:content-[attr(data-label)] before:items-center before:mr-auto before:text-gray-500 first:border-t-0 dark:before:text-gray-400 lg:before:hidden lg:first:border-t lg:py-3 lg:table-cell dark:border-gray-800" data-label="{% trans 'Object' %}">
41
+ <a href="{% url opts|admin_urlname:'simple_history' object.pk action.pk %}">
42
+ {{ action.history_object }}
43
+ </a>
44
+ </td>
45
+
46
+ {% for column in history_list_display %}
47
+ <td class="align-middle flex border-t border-gray-200 font-normal px-3 py-2 text-left text-sm before:flex before:capitalize before:content-[attr(data-label)] before:items-center before:mr-auto before:text-gray-500 first:border-t-0 dark:before:text-gray-400 lg:before:hidden lg:first:border-t lg:py-3 lg:table-cell dark:border-gray-800" data-label="{% trans column %}">
48
+ {{ action|getattribute:column }}
49
+ </th>
50
+ {% endfor %}
51
+
52
+ <td class="align-middle flex border-t border-gray-200 font-normal px-3 py-2 text-left text-sm before:flex before:capitalize before:content-[attr(data-label)] before:items-center before:mr-auto before:text-gray-500 first:border-t-0 dark:before:text-gray-400 lg:before:hidden lg:first:border-t lg:py-3 lg:table-cell dark:border-gray-800" data-label="{% trans 'Date/time' %}">
53
+ {{ action.history_date }}
54
+ </td>
55
+
56
+ <td class="align-middle flex border-t border-gray-200 font-normal px-3 py-2 text-left text-sm before:flex before:capitalize before:content-[attr(data-label)] before:items-center before:mr-auto before:text-gray-500 first:border-t-0 dark:before:text-gray-400 lg:before:hidden lg:first:border-t lg:py-3 lg:table-cell dark:border-gray-800" data-label="{% trans 'Comment' %}">
57
+ {{ action.get_history_type_display }}
58
+ </td>
59
+
60
+ <td class="align-middle flex border-t border-gray-200 font-normal px-3 py-2 text-left text-sm before:flex before:capitalize before:content-[attr(data-label)] before:items-center before:mr-auto before:text-gray-500 first:border-t-0 dark:before:text-gray-400 lg:before:hidden lg:first:border-t lg:py-3 lg:table-cell dark:border-gray-800" data-label="{% trans 'Changed by' %}">
61
+ {% if action.history_user %}
62
+ {% url admin_user_view action.history_user_id as admin_user_url %}
63
+
64
+ {% if admin_user_url %}
65
+ <a href="{{ admin_user_url }}">{{ action.history_user }}</a>
66
+ {% else %}
67
+ {{ action.history_user }}
68
+ {% endif %}
69
+ {% else %}
70
+ {% trans "None" %}
71
+ {% endif %}
72
+ </td>
73
+
74
+ <td class="align-middle flex border-t border-gray-200 font-normal px-3 py-2 text-left text-sm before:flex before:capitalize before:content-[attr(data-label)] before:items-center before:mr-auto before:text-gray-500 first:border-t-0 dark:before:text-gray-400 lg:before:hidden lg:first:border-t lg:py-3 lg:table-cell dark:border-gray-800" data-label="{% trans 'Change reason' %}">
75
+ {{ action.history_change_reason }}
76
+ </td>
77
+ </tr>
78
+ {% endfor %}
79
+ </tbody>
80
+ </table>
@@ -0,0 +1,21 @@
1
+ {% extends "admin/object_history.html" %}
2
+
3
+ {% load admin_urls i18n %}
4
+ {% load url from simple_history_compat %}
5
+ {% load display_list from simple_history_admin_list %}
6
+
7
+ {% block content %}
8
+ {% if not revert_disabled %}
9
+ <p class="px-3 py-3 rounded-md text-sm last:mb-8 er-amber-600/10 bg-blue-50 mb-8 text-blue-500 dark:bg-blue-500/20 dark:border-blue-500/10">
10
+ {% blocktrans %}Choose a date from the list below to revert to a previous version of this object.{% endblocktrans %}
11
+ </p>
12
+ {% endif %}
13
+
14
+ {% if action_list %}
15
+ {% display_list %}
16
+ {% else %}
17
+ <p class="mb-3 px-3 py-3 rounded-md text-sm last:mb-8 bg-amber-100 text-amber-600 dark:bg-amber-600/20 dark:border-amber-600/10">
18
+ {% trans "This object doesn't have a change history." %}
19
+ </p>
20
+ {% endif %}
21
+ {% endblock %}
@@ -0,0 +1,55 @@
1
+ {% extends "admin/change_form.html" %}
2
+
3
+ {% load admin_urls i18n %}
4
+ {% load url from simple_history_compat%}
5
+
6
+ {% block breadcrumbs %}
7
+ <div class="px-4 lg:px-12">
8
+ <div class="container mb-6 mx-auto -my-3 lg:mb-12">
9
+ <ul class="flex">
10
+ {% url 'admin:index' as link %}
11
+ {% trans 'Home' as name %}
12
+ {% include 'unfold/helpers/breadcrumb_item.html' with link=link name=name %}
13
+
14
+ {% url 'admin:app_list' app_label=opts.app_label as link %}
15
+ {% include 'unfold/helpers/breadcrumb_item.html' with link=link name=opts.app_config.verbose_name %}
16
+
17
+ {% include 'unfold/helpers/breadcrumb_item.html' with link=changelist_url name=opts.verbose_name_plural|capfirst %}
18
+
19
+ {% include 'unfold/helpers/breadcrumb_item.html' with link=change_url name=original|truncatewords:'18' %}
20
+
21
+ {% url opts|admin_urlname:'change' object.pk|admin_urlquote as link %}
22
+ {% trans 'History' as name %}
23
+ {% include 'unfold/helpers/breadcrumb_item.html' with link="../" name=name %}
24
+
25
+ {% if revert_disabled %}
26
+ {% trans "View" as name %}
27
+ {% include 'unfold/helpers/breadcrumb_item.html' with link="" name=name %}
28
+ {% else %}
29
+ {% trans "Revert" as name %}
30
+ {% include 'unfold/helpers/breadcrumb_item.html' with link="" name=name %}
31
+ {% endif %}
32
+ </ul>
33
+ </div>
34
+ </div>
35
+ {% endblock %}
36
+
37
+ {% block submit_buttons_top %}
38
+ {% include "simple_history/submit_line.html" %}
39
+ {% endblock %}
40
+
41
+ {% block submit_buttons_bottom %}
42
+ {% include "simple_history/submit_line.html" %}
43
+ {% endblock %}
44
+
45
+ {% block form_top %}
46
+ <p class="px-3 py-3 rounded-md text-sm last:mb-8 er-amber-600/10 bg-blue-50 mb-8 text-blue-500 dark:bg-blue-500/20 dark:border-blue-500/10">
47
+ {% if not revert_disabled %}
48
+ {% blocktrans %}Press the 'Revert' button below to revert to this version of the object.{% endblocktrans %}
49
+ {% endif %}
50
+
51
+ {% if change_history %}
52
+ {% blocktrans %}Press the 'Change History' button below to edit the history.{% endblocktrans %}
53
+ {% endif %}
54
+ </p>
55
+ {% endblock %}
@@ -0,0 +1,25 @@
1
+ {% load i18n %}
2
+
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
+ <div class="{% if not is_popup %}bottom-0 fixed left-0 right-0 xl:left-72{% endif %}" :class="{'xl:left-0': !sidebarDesktopOpen}">
5
+ <div class="bg-white dark:bg-gray-900 {% if not is_popup %}border-t px-4 py-4 relative scrollable-top lg:px-12 dark:border-gray-800{% endif %}">
6
+ <div class="container flex flex-col-reverse gap-3 items-center mx-auto lg:flex-row-reverse">
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 }}>
9
+ {% trans 'Revert' %}
10
+ </button>
11
+ {% endif %}
12
+
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 }}>
15
+ {% trans 'Change History' %}
16
+ </button>
17
+ {% endif %}
18
+
19
+ <a href="{{ history_url }}" class="border font-medium hidden mr-auto px-3 py-2 rounded-md text-sm text-gray-500 transition-all w-full hover:bg-gray-50 lg:block lg:w-auto dark:border-gray-700 dark:text-gray-400 dark:hover:text-gray-200 dark:hover:bg-gray-900">
20
+ {% trans 'Close' %}
21
+ </a>
22
+ </div>
23
+ </div>
24
+ </div>
25
+ </div>
unfold/settings.py CHANGED
@@ -20,6 +20,7 @@ CONFIG_DEFAULTS = {
20
20
  "700": "126 34 206",
21
21
  "800": "107 33 168",
22
22
  "900": "88 28 135",
23
+ "950": "59 7 100",
23
24
  },
24
25
  },
25
26
  "DASHBOARD_CALLBACK": None,
unfold/sites.py CHANGED
@@ -11,6 +11,7 @@ from django.utils.functional import lazy
11
11
  from django.utils.module_loading import import_string
12
12
 
13
13
  from .settings import get_config
14
+ from .widgets import INPUT_CLASSES
14
15
 
15
16
 
16
17
  class UnfoldAdminSite(AdminSite):
@@ -51,6 +52,9 @@ class UnfoldAdminSite(AdminSite):
51
52
 
52
53
  context.update(
53
54
  {
55
+ "form_classes": {
56
+ "text_input": INPUT_CLASSES,
57
+ },
54
58
  "logo": self._get_value(
55
59
  get_config(self.settings_name)["SIDEBAR"].get("logo"), request
56
60
  ),