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.
Files changed (76) hide show
  1. django_unfold-0.38.0.dist-info/METADATA +70 -0
  2. {django_unfold-0.36.0.dist-info → django_unfold-0.38.0.dist-info}/RECORD +75 -74
  3. unfold/admin.py +2 -1
  4. unfold/contrib/filters/templates/unfold/filters/filters_date_range.html +1 -1
  5. unfold/contrib/filters/templates/unfold/filters/filters_datetime_range.html +1 -1
  6. unfold/contrib/filters/templates/unfold/filters/filters_numeric_range.html +1 -1
  7. unfold/contrib/filters/templates/unfold/filters/filters_numeric_single.html +1 -1
  8. unfold/contrib/filters/templates/unfold/filters/filters_numeric_slider.html +4 -4
  9. unfold/contrib/forms/templates/unfold/forms/helpers/toolbar.html +6 -6
  10. unfold/contrib/forms/widgets.py +1 -0
  11. unfold/contrib/guardian/templates/admin/guardian/model/obj_perms_manage_group.html +1 -1
  12. unfold/contrib/guardian/templates/admin/guardian/model/obj_perms_manage_user.html +1 -1
  13. unfold/contrib/guardian/templates/unfold/guardian/group_form.html +5 -5
  14. unfold/contrib/guardian/templates/unfold/guardian/user_form.html +5 -5
  15. unfold/contrib/import_export/forms.py +1 -0
  16. unfold/contrib/import_export/templates/admin/import_export/change_form.html +1 -1
  17. unfold/contrib/import_export/templates/admin/import_export/import.html +13 -13
  18. unfold/contrib/import_export/templates/admin/import_export/import_errors.html +3 -3
  19. unfold/contrib/inlines/admin.py +1 -0
  20. unfold/contrib/simple_history/templates/simple_history/object_history.html +1 -1
  21. unfold/contrib/simple_history/templates/simple_history/object_history_list.html +8 -8
  22. unfold/contrib/simple_history/templates/simple_history/submit_line.html +1 -1
  23. unfold/settings.py +26 -1
  24. unfold/static/unfold/css/styles.css +1 -1
  25. unfold/static/unfold/js/app.js +7 -1
  26. unfold/styles.css +1 -1
  27. unfold/templates/admin/app_list.html +3 -3
  28. unfold/templates/admin/auth/user/add_form.html +1 -1
  29. unfold/templates/admin/base_site.html +1 -1
  30. unfold/templates/admin/change_form.html +1 -1
  31. unfold/templates/admin/change_list.html +8 -13
  32. unfold/templates/admin/change_list_results.html +2 -2
  33. unfold/templates/admin/delete_confirmation.html +6 -6
  34. unfold/templates/admin/delete_selected_confirmation.html +5 -5
  35. unfold/templates/admin/edit_inline/stacked.html +7 -5
  36. unfold/templates/admin/edit_inline/tabular.html +3 -3
  37. unfold/templates/admin/filter.html +1 -1
  38. unfold/templates/admin/includes/fieldset.html +1 -1
  39. unfold/templates/admin/includes/object_delete_summary.html +1 -1
  40. unfold/templates/admin/login.html +2 -2
  41. unfold/templates/admin/nav_sidebar.html +1 -1
  42. unfold/templates/admin/search_form.html +1 -1
  43. unfold/templates/auth/widgets/read_only_password_hash.html +2 -2
  44. unfold/templates/registration/logged_out.html +1 -1
  45. unfold/templates/registration/password_change_done.html +3 -3
  46. unfold/templates/unfold/change_list_filter.html +31 -15
  47. unfold/templates/unfold/components/card.html +1 -1
  48. unfold/templates/unfold/components/navigation.html +1 -1
  49. unfold/templates/unfold/components/title.html +1 -1
  50. unfold/templates/unfold/helpers/actions_row.html +14 -14
  51. unfold/templates/unfold/helpers/app_list.html +8 -8
  52. unfold/templates/unfold/helpers/display_header.html +1 -1
  53. unfold/templates/unfold/helpers/fieldset_row.html +2 -2
  54. unfold/templates/unfold/helpers/fieldsets_tabs.html +4 -4
  55. unfold/templates/unfold/helpers/form_label.html +1 -1
  56. unfold/templates/unfold/helpers/label.html +13 -13
  57. unfold/templates/unfold/helpers/messages.html +12 -12
  58. unfold/templates/unfold/helpers/navigation.html +2 -2
  59. unfold/templates/unfold/helpers/search.html +1 -1
  60. unfold/templates/unfold/helpers/tab_action.html +1 -1
  61. unfold/templates/unfold/helpers/tab_list.html +2 -0
  62. unfold/templates/unfold/helpers/welcomemsg.html +3 -3
  63. unfold/templates/unfold/layouts/skeleton.html +47 -47
  64. unfold/templates/unfold/widgets/clearable_file_input.html +2 -2
  65. unfold/templates/unfold/widgets/clearable_file_input_small.html +10 -2
  66. unfold/templates/unfold/widgets/foreign_key_raw_id.html +6 -4
  67. unfold/templates/unfold/widgets/radio_option.html +3 -3
  68. unfold/templates/unfold/widgets/range.html +8 -8
  69. unfold/templates/unfold/widgets/related_widget_wrapper.html +6 -6
  70. unfold/templates/unfold/widgets/url.html +7 -0
  71. unfold/templatetags/unfold_list.py +0 -7
  72. unfold/utils.py +6 -1
  73. unfold/widgets.py +26 -6
  74. django_unfold-0.36.0.dist-info/METADATA +0 -1455
  75. {django_unfold-0.36.0.dist-info → django_unfold-0.38.0.dist-info}/LICENSE.md +0 -0
  76. {django_unfold-0.36.0.dist-info → django_unfold-0.38.0.dist-info}/WHEEL +0 -0
@@ -4,6 +4,7 @@ from import_export.forms import ImportForm as BaseImportForm
4
4
  from import_export.forms import (
5
5
  SelectableFieldsExportForm as BaseSelectableFieldsExportForm,
6
6
  )
7
+
7
8
  from unfold.widgets import (
8
9
  SELECT_CLASSES,
9
10
  UnfoldAdminFileFieldWidget,
@@ -5,6 +5,6 @@
5
5
  {{ block.super }}
6
6
 
7
7
  {% if show_change_form_export %}
8
- <input type="submit" value="{% translate 'Export' %}" name="_export-item" class="bg-white text-gray-500 border cursor-pointer flex font-medium items-center px-3 py-2 mr-3 rounded-md shadow-sm text-sm dark:bg-gray-900 dark:border dark:border-gray-700 dark:text-gray-300">
8
+ <input type="submit" value="{% translate 'Export' %}" name="_export-item" class="bg-white text-gray-500 border cursor-pointer flex font-medium items-center px-3 py-2 mr-3 rounded-md shadow-sm text-sm dark:bg-gray-900 dark:border dark:border-gray-700 dark:text-font-default-dark">
9
9
  {% endif %}
10
10
  {% endblock %}
@@ -44,19 +44,19 @@
44
44
  {% endblock %}
45
45
 
46
46
  {% block content %}
47
- {% if confirm_form %}
48
- {% include "admin/import_export/import_confirm.html" %}
49
- {% else %}
50
- {% include "admin/import_export/import_form.html" %}
51
- {% endif %}
52
-
53
- {% if result %}
54
- {% if result.has_errors %}
55
- {% include "admin/import_export/import_errors.html" %}
56
- {% elif result.has_validation_errors %}
57
- {% include "admin/import_export/import_validation.html" %}
47
+ {% if confirm_form %}
48
+ {% include "admin/import_export/import_confirm.html" %}
58
49
  {% else %}
59
- {% include "admin/import_export/import_preview.html" %}
50
+ {% include "admin/import_export/import_form.html" %}
51
+ {% endif %}
52
+
53
+ {% if result %}
54
+ {% if result.has_errors %}
55
+ {% include "admin/import_export/import_errors.html" %}
56
+ {% elif result.has_validation_errors %}
57
+ {% include "admin/import_export/import_validation.html" %}
58
+ {% else %}
59
+ {% include "admin/import_export/import_preview.html" %}
60
+ {% endif %}
60
61
  {% endif %}
61
- {% endif %}
62
62
  {% endblock %}
@@ -6,9 +6,9 @@
6
6
  <ul>
7
7
  {% for error in result.base_errors %}
8
8
  <li>
9
- {{ error.error }}
9
+ {{ error.error }}
10
10
 
11
- <div class="traceback">{{ error.traceback|linebreaks }}</div></li>
11
+ <div class="traceback">{{ error.traceback|linebreaks }}</div></li>
12
12
  {% endfor %}
13
13
 
14
14
  {% for line, errors in result.row_errors %}
@@ -26,7 +26,7 @@
26
26
  </div>
27
27
  </div>
28
28
 
29
- <div class="block border leading-relaxed mb-4 rounded p-4 traceback dark:border-gray-800 dark:text-gray-300 " x-show="open">
29
+ <div class="block border leading-relaxed mb-4 rounded p-4 traceback dark:border-gray-800 dark:text-font-default-dark " x-show="open">
30
30
  {{ error.traceback|linebreaks }}
31
31
  </div>
32
32
  </li>
@@ -11,6 +11,7 @@ from django.forms.models import modelform_defines_fields
11
11
  from django.http import HttpRequest
12
12
  from django.utils.text import get_text_list
13
13
  from django.utils.translation import gettext_lazy as _
14
+
14
15
  from unfold.admin import StackedInline, TabularInline
15
16
 
16
17
  from .checks import NonrelatedModelAdminChecks
@@ -4,7 +4,7 @@
4
4
 
5
5
  {% block content %}
6
6
  {% if not revert_disabled %}
7
- <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">
7
+ <p class="px-3 py-3 rounded-md text-sm last:mb-8 mb-8 bg-blue-100 text-blue-700 dark:bg-blue-500/20 dark:text-blue-400">
8
8
  {% blocktrans %}Choose a date from the list below to revert to a previous version of this object.{% endblocktrans %}
9
9
  </p>
10
10
  {% endif %}
@@ -4,35 +4,35 @@
4
4
  {% load getattribute from getattributes %}
5
5
 
6
6
  <table id="change-history" class="border-gray-200 border-spacing-none border-separate mb-6 w-full lg:border lg:rounded-md lg:shadow-sm lg:dark:border-gray-800">
7
- <thead class="hidden text-gray-900 lg:table-header-group dark:text-gray-100">
7
+ <thead class="hidden text-font-important-light lg:table-header-group dark:text-font-important-dark">
8
8
  <tr>
9
- <th class="align-middle font-medium px-3 py-2 text-left ">
9
+ <th class="align-middle font-semibold px-3 py-2 text-left ">
10
10
  {% trans 'Object' %}
11
11
  </th>
12
12
 
13
13
  {% for column in history_list_display %}
14
- <th class="align-middle font-medium px-3 py-2 text-left ">
14
+ <th class="align-middle font-semibold px-3 py-2 text-left ">
15
15
  {% trans column %}
16
16
  </th>
17
17
  {% endfor %}
18
18
 
19
- <th class="align-middle font-medium px-3 py-2 text-left">
19
+ <th class="align-middle font-semibold px-3 py-2 text-left">
20
20
  {% trans 'Date/time' %}
21
21
  </th>
22
22
 
23
- <th class="align-middle font-medium px-3 py-2 text-left">
23
+ <th class="align-middle font-semibold px-3 py-2 text-left">
24
24
  {% trans 'Comment' %}
25
25
  </th>
26
26
 
27
- <th class="align-middle font-medium px-3 py-2 text-left">
27
+ <th class="align-middle font-semibold px-3 py-2 text-left">
28
28
  {% trans 'Changed by' %}
29
29
  </th>
30
30
 
31
- <th class="align-middle font-medium px-3 py-2 text-left">
31
+ <th class="align-middle font-semibold px-3 py-2 text-left">
32
32
  {% trans 'Change reason' %}
33
33
  </th>
34
34
 
35
- <th class="align-middle font-medium px-3 py-2 text-left">
35
+ <th class="align-middle font-semibold px-3 py-2 text-left">
36
36
  {% trans 'Changes' %}
37
37
  </th>
38
38
  </tr>
@@ -16,7 +16,7 @@
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-gray-300 dark:hover:text-gray-200 dark:hover:bg-gray-900">
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">
20
20
  {% trans 'Close' %}
21
21
  </a>
22
22
  </div>
unfold/settings.py CHANGED
@@ -1,3 +1,5 @@
1
+ from typing import Any, Dict
2
+
1
3
  from django.conf import settings
2
4
 
3
5
  CONFIG_DEFAULTS = {
@@ -11,6 +13,14 @@ CONFIG_DEFAULTS = {
11
13
  "SHOW_HISTORY": True,
12
14
  "SHOW_VIEW_ON_SITE": True,
13
15
  "COLORS": {
16
+ "font": {
17
+ "subtle-light": "107 114 128", # text-gray-500
18
+ "subtle-dark": "156 163 175", # text-gray-400
19
+ "default-light": "75 85 99", # text-gray-600
20
+ "default-dark": "209 213 219", # text-gray-300
21
+ "important-light": "17 24 39", # text-gray-900
22
+ "important-dark": "243 244 246", # text-gray-100
23
+ },
14
24
  "primary": {
15
25
  "50": "250 245 255",
16
26
  "100": "243 232 255",
@@ -47,4 +57,19 @@ def get_config(settings_name=None):
47
57
  if settings_name is None:
48
58
  settings_name = "UNFOLD"
49
59
 
50
- return {**CONFIG_DEFAULTS, **getattr(settings, settings_name, {})}
60
+ def merge_dicts(dict1: Dict[str, Any], dict2: Dict[str, Any]) -> Dict[str, Any]:
61
+ result = dict1.copy()
62
+
63
+ for key, value in dict2.items():
64
+ if (
65
+ key in result
66
+ and isinstance(result[key], dict)
67
+ and isinstance(value, dict)
68
+ ):
69
+ result[key] = merge_dicts(result[key], value)
70
+ else:
71
+ result[key] = value
72
+
73
+ return result
74
+
75
+ return merge_dicts(CONFIG_DEFAULTS, getattr(settings, settings_name, {}))