django-unfold 0.65.0__py3-none-any.whl → 0.67.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. {django_unfold-0.65.0.dist-info → django_unfold-0.67.0.dist-info}/METADATA +4 -2
  2. {django_unfold-0.65.0.dist-info → django_unfold-0.67.0.dist-info}/RECORD +33 -31
  3. {django_unfold-0.65.0.dist-info → django_unfold-0.67.0.dist-info}/WHEEL +1 -1
  4. unfold/admin.py +1 -1
  5. unfold/contrib/constance/settings.py +1 -0
  6. unfold/contrib/filters/admin/numeric_filters.py +2 -0
  7. unfold/contrib/filters/forms.py +25 -4
  8. unfold/contrib/filters/static/unfold/filters/js/admin-numeric-filter.js +62 -28
  9. unfold/contrib/filters/templates/unfold/filters/filters_numeric_slider.html +2 -11
  10. unfold/contrib/location_field/templates/location_field/map_widget.html +1 -1
  11. unfold/fields.py +41 -0
  12. unfold/sites.py +43 -13
  13. unfold/static/unfold/css/styles.css +1 -1
  14. unfold/static/unfold/js/app.js +117 -14
  15. unfold/static/unfold/js/select2.init.js +2 -9
  16. unfold/styles.css +25 -15
  17. unfold/templates/admin/nav_sidebar.html +1 -1
  18. unfold/templates/unfold/components/button.html +1 -1
  19. unfold/templates/unfold/components/card.html +15 -6
  20. unfold/templates/unfold/components/layer.html +1 -0
  21. unfold/templates/unfold/components/progress.html +14 -8
  22. unfold/templates/unfold/components/tracker.html +1 -1
  23. unfold/templates/unfold/helpers/app_list.html +1 -1
  24. unfold/templates/unfold/helpers/boolean.html +1 -1
  25. unfold/templates/unfold/helpers/command.html +1 -1
  26. unfold/templates/unfold/helpers/command_results.html +31 -12
  27. unfold/templates/unfold/helpers/field_readonly_value.html +1 -1
  28. unfold/templates/unfold/helpers/field_readonly_value_file.html +18 -0
  29. unfold/templates/unfold/helpers/search.html +1 -0
  30. unfold/templates/unfold/widgets/clearable_file_input_small.html +1 -1
  31. unfold/templatetags/unfold.py +44 -7
  32. unfold/widgets.py +3 -3
  33. {django_unfold-0.65.0.dist-info → django_unfold-0.67.0.dist-info/licenses}/LICENSE.md +0 -0
@@ -1,5 +1,5 @@
1
1
  import json
2
- from collections.abc import Mapping
2
+ from collections.abc import Iterable, Mapping
3
3
  from typing import Any, Optional, Union
4
4
 
5
5
  from django import template
@@ -235,18 +235,24 @@ class RenderComponentNode(template.Node):
235
235
  name: var.resolve(context) for name, var in self.extra_context.items()
236
236
  }
237
237
 
238
- values.update(
239
- {
240
- "children": self.nodelist.render(context),
241
- }
242
- )
243
-
244
238
  if "component_class" in values:
245
239
  values = ComponentRegistry.create_instance(
246
240
  values["component_class"],
247
241
  request=context.request if hasattr(context, "request") else None,
248
242
  ).get_context_data(**values)
249
243
 
244
+ context_copy = context.new()
245
+ context_copy.update(context.flatten())
246
+ context_copy.update(values)
247
+ children = self.nodelist.render(context_copy)
248
+
249
+ if len(children) > 0:
250
+ values.update(
251
+ {
252
+ "children": children,
253
+ }
254
+ )
255
+
250
256
  if self.include_context:
251
257
  values.update(context.flatten())
252
258
 
@@ -607,6 +613,37 @@ def querystring_params(
607
613
  return result.urlencode()
608
614
 
609
615
 
616
+ @register.simple_tag(name="unfold_querystring", takes_context=True)
617
+ def unfold_querystring(context, *args, **kwargs):
618
+ """
619
+ Duplicated querystring template tag from Django core to allow
620
+ it using in Django 4.x. Once 4.x is not supported, remove it.
621
+ """
622
+ if not args:
623
+ args = [context.request.GET]
624
+ params = QueryDict(mutable=True)
625
+ for d in [*args, kwargs]:
626
+ if not isinstance(d, Mapping):
627
+ raise TemplateSyntaxError(
628
+ "querystring requires mappings for positional arguments (got "
629
+ f"{d!r} instead)."
630
+ )
631
+ for key, value in d.items():
632
+ if not isinstance(key, str):
633
+ raise TemplateSyntaxError(
634
+ f"querystring requires strings for mapping keys (got {key!r} "
635
+ "instead)."
636
+ )
637
+ if value is None:
638
+ params.pop(key, None)
639
+ elif isinstance(value, Iterable) and not isinstance(value, str):
640
+ params.setlist(key, value)
641
+ else:
642
+ params[key] = value
643
+ query_string = params.urlencode() if params else ""
644
+ return f"?{query_string}"
645
+
646
+
610
647
  @register.simple_tag(takes_context=True)
611
648
  def header_title(context: RequestContext) -> str:
612
649
  parts = []
unfold/widgets.py CHANGED
@@ -254,9 +254,9 @@ SWITCH_CLASSES = [
254
254
  "transition-colors",
255
255
  "w-8",
256
256
  "min-w-8",
257
- "focus:outline-2",
258
- "focus:outline-offset-2",
259
- "focus:outline-primary-600",
257
+ "disabled:cursor-not-allowed",
258
+ "disabled:opacity-50",
259
+ "focus:outline-none",
260
260
  "after:absolute",
261
261
  "after:bg-white",
262
262
  "after:content-['']",