django-smartbase-admin 1.0.6b1__py3-none-any.whl → 1.0.6b2__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.
@@ -63,11 +63,17 @@ class SBAdminBaseWidget(ContextMixin):
63
63
  opts = (
64
64
  self.form_field.view.opts
65
65
  if self.form_field
66
- and hasattr(self.form_field, "view")
67
- and hasattr(self.form_field.view, "opts")
66
+ and hasattr(self.form_field, "view")
67
+ and hasattr(self.form_field.view, "opts")
68
68
  else None
69
69
  )
70
- modal_prefix = "modal__" if is_modal(SBAdminThreadLocalService.get_request()) else ""
70
+ modal_prefix = ""
71
+ try:
72
+ modal_prefix = (
73
+ "modal__" if is_modal(SBAdminThreadLocalService.get_request()) else ""
74
+ )
75
+ except:
76
+ pass
71
77
  if opts:
72
78
  context["widget"]["attrs"][
73
79
  "id"
@@ -136,12 +142,12 @@ class SBAdminToggleWidget(SBAdminBaseWidget, forms.CheckboxInput):
136
142
  class SBAdminCKEditorWidget(SBAdminBaseWidget, CKEditorWidget):
137
143
 
138
144
  def __init__(
139
- self,
140
- config_name="default",
141
- extra_plugins=None,
142
- external_plugin_resources=None,
143
- form_field=None,
144
- attrs=None,
145
+ self,
146
+ config_name="default",
147
+ extra_plugins=None,
148
+ external_plugin_resources=None,
149
+ form_field=None,
150
+ attrs=None,
145
151
  ):
146
152
  super().__init__(
147
153
  form_field,
@@ -358,13 +364,13 @@ class SBAdminAutocompleteWidget(
358
364
  def get_context(self, name, value, attrs):
359
365
  context = super().get_context(name, value, attrs)
360
366
  self.input_id = (
361
- context["widget"]["attrs"]["id"] or f'id_{context["widget"]["name"]}'
367
+ context["widget"]["attrs"]["id"] or f'id_{context["widget"]["name"]}'
362
368
  )
363
369
  context["widget"]["type"] = "hidden"
364
370
  context["widget"]["attrs"]["id"] = self.input_id
365
371
  context["widget"]["attrs"]["class"] = "js-autocomplete-detail"
366
372
  context["widget"]["attrs"]["data-empty-label"] = (
367
- getattr(self.form_field, "empty_label", "---------") or "---------"
373
+ getattr(self.form_field, "empty_label", "---------") or "---------"
368
374
  )
369
375
  query_suffix = "__in"
370
376
  threadsafe_request = SBAdminThreadLocalService.get_request()
@@ -386,7 +392,7 @@ class SBAdminAutocompleteWidget(
386
392
  if parsed_value:
387
393
  selected_options = []
388
394
  for item in self.get_queryset(threadsafe_request).filter(
389
- **{f"{self.get_value_field()}{query_suffix}": parsed_value}
395
+ **{f"{self.get_value_field()}{query_suffix}": parsed_value}
390
396
  ):
391
397
  selected_options.append(
392
398
  {
@@ -398,13 +404,11 @@ class SBAdminAutocompleteWidget(
398
404
  context["widget"]["value"] = json.dumps(selected_options)
399
405
  context["widget"]["value_list"] = selected_options
400
406
 
401
- if (
402
- threadsafe_request.request_data.configuration.autocomplete_show_related_buttons(
403
- self.model,
404
- field_name=self.field_name,
405
- current_view=self.view,
406
- request=threadsafe_request,
407
- )
407
+ if threadsafe_request.request_data.configuration.autocomplete_show_related_buttons(
408
+ self.model,
409
+ field_name=self.field_name,
410
+ current_view=self.view,
411
+ request=threadsafe_request,
408
412
  ):
409
413
  self.add_related_buttons_urls(parsed_value, context)
410
414
 
@@ -551,16 +555,16 @@ class SBAdminCodeWidget(SBAdminBaseWidget, forms.Widget):
551
555
  def __init__(self, form_field=None, *args, **kwargs):
552
556
  super().__init__(form_field, *args, **kwargs)
553
557
  self.attrs = {
554
- "code-mirror-options": json.dumps(
555
- {
556
- "mode": "django",
557
- "theme": "dracula",
558
- "lineWrapping": "true",
559
- }
560
- ),
561
- "code-mirror-width": "100%",
562
- "code-mirror-height": "300",
563
- } | self.attrs
558
+ "code-mirror-options": json.dumps(
559
+ {
560
+ "mode": "django",
561
+ "theme": "dracula",
562
+ "lineWrapping": "true",
563
+ }
564
+ ),
565
+ "code-mirror-width": "100%",
566
+ "code-mirror-height": "300",
567
+ } | self.attrs
564
568
 
565
569
  class Media:
566
570
  css = {
@@ -670,9 +674,9 @@ class SBAdminTreeWidget(SBAdminTreeWidgetMixin, SBAdminAutocompleteWidget):
670
674
  parsed_value = self.parse_value_from_input(threadsafe_request, input_value)
671
675
  obj = self.form.instance
672
676
  if (
673
- obj
674
- and parsed_value
675
- and self.relationship_pick_mode == self.RELATIONSHIP_PICK_MODE_PARENT
677
+ obj
678
+ and parsed_value
679
+ and self.relationship_pick_mode == self.RELATIONSHIP_PICK_MODE_PARENT
676
680
  ):
677
681
  if obj.id == parsed_value:
678
682
  raise ValidationError(_("Cannot set parent to itself"))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: django-smartbase-admin
3
- Version: 1.0.6b1
3
+ Version: 1.0.6b2
4
4
  Summary:
5
5
  Home-page: https://smartbase-sk.github.io/django-smartbase-admin-docs/
6
6
  License: MIT
@@ -5,7 +5,7 @@ django_smartbase_admin/actions/advanced_filters.py,sha256=Vm8b6TAwNehR8INjolFG7p
5
5
  django_smartbase_admin/admin/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  django_smartbase_admin/admin/admin_base.py,sha256=VkIah1Mw6g-73kBGudKtUpfkuzh38eBIUr5jRffh4ko,46202
7
7
  django_smartbase_admin/admin/site.py,sha256=VrJBhwgZsLa2GohvjnNL7m4dVR3S4Ou1V1UzfE1qOoQ,6577
8
- django_smartbase_admin/admin/widgets.py,sha256=8kSMMB4fZW33eFaiXQIEKrdwPABp9-3ty_pCmRVhbEk,25070
8
+ django_smartbase_admin/admin/widgets.py,sha256=DhwWzfsDHRfTu4aKb_NGlwi26sCHW_ezZWCE7UuG5xw,24926
9
9
  django_smartbase_admin/apps.py,sha256=C1wT1YUEZNKcUJfpD01nIZEFgYEsuav52WFKvEURRDU,545
10
10
  django_smartbase_admin/compilemessages.py,sha256=-_FEFQlOvE4L8UzSuUxSxZQjgGlwL9IZtmg59fW_kIQ,342
11
11
  django_smartbase_admin/engine/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -691,7 +691,7 @@ django_smartbase_admin/views/dashboard_view.py,sha256=vtz5emYTQ5WDFeLA8HrcmjSOVd
691
691
  django_smartbase_admin/views/global_filter_view.py,sha256=eYo1moJGyi7jc2cPDA5ZBiEgA7Hmc-DxbQvbqUpDkg8,1127
692
692
  django_smartbase_admin/views/media_view.py,sha256=5BLWXuzynF7nM34t-mf2BQSRN5ojY8HxpLIqt7Jiq9g,292
693
693
  django_smartbase_admin/views/translations_view.py,sha256=JlAE9EPrTmbEVXqX7r0NjdbEv0c9BK3YDj_BYCIPPck,20351
694
- django_smartbase_admin-1.0.6b1.dist-info/LICENSE.md,sha256=okRGMBOYvyhprt2eTpX_QXqpzC0MODF-U7zX-4fKPjQ,1078
695
- django_smartbase_admin-1.0.6b1.dist-info/METADATA,sha256=17IVWZJNC31SFfncKLiT0EdZsVNl3a6W_Kun-cBfpbs,5335
696
- django_smartbase_admin-1.0.6b1.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
697
- django_smartbase_admin-1.0.6b1.dist-info/RECORD,,
694
+ django_smartbase_admin-1.0.6b2.dist-info/LICENSE.md,sha256=okRGMBOYvyhprt2eTpX_QXqpzC0MODF-U7zX-4fKPjQ,1078
695
+ django_smartbase_admin-1.0.6b2.dist-info/METADATA,sha256=5ITmABgNn1WvFjvqV3_Fdv83ZiL2QinRqDC9sqOSTKA,5335
696
+ django_smartbase_admin-1.0.6b2.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
697
+ django_smartbase_admin-1.0.6b2.dist-info/RECORD,,