django-spire 0.23.0__py3-none-any.whl → 0.23.2__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.
django_spire/consts.py CHANGED
@@ -1,4 +1,4 @@
1
- __VERSION__ = '0.23.0'
1
+ __VERSION__ = '0.23.2'
2
2
 
3
3
  MAINTENANCE_MODE_SETTINGS_NAME = 'MAINTENANCE_MODE'
4
4
 
@@ -1,7 +1,6 @@
1
- from enum import Enum
1
+ from enum import StrEnum
2
2
 
3
3
 
4
- # Todo: Change to string enum
5
- class SessionFilterActionEnum(Enum):
4
+ class SessionFilterActionEnum(StrEnum):
6
5
  CLEAR = 'Clear'
7
6
  FILTER = 'Filter'
@@ -22,24 +22,35 @@ class SessionFilterQuerySetMixin(QuerySet):
22
22
  ) -> QuerySet:
23
23
  # Session keys must match to process new queryset data
24
24
 
25
- action = request.GET.get('action')
25
+ try:
26
+ action = SessionFilterActionEnum(request.GET.get('action'))
27
+ except ValueError:
28
+ action = None
29
+
26
30
  form = form_class(request.GET)
27
31
 
28
32
  if form.is_valid():
29
33
  session = SessionController(request=request, session_key=session_key)
30
34
 
31
- # Todo: Change actions into an enum
32
- if action == SessionFilterActionEnum.CLEAR.value:
35
+ if action == SessionFilterActionEnum.CLEAR:
33
36
  session.purge()
34
37
  return self
35
38
 
36
- # The user has submitted the filter form
37
- if action == SessionFilterActionEnum.FILTER.value and session_key == request.GET.get('session_filter_key'):
38
-
39
+ # Apply filters when the user submits the filter form
40
+ if (
41
+ action == SessionFilterActionEnum.FILTER
42
+ and session_key == request.GET.get('session_filter_key')
43
+ ):
39
44
  # Update session data
40
45
  for key, value in form.cleaned_data.items():
41
46
  session.add_data(key, value)
42
47
 
48
+ # If the session is expired, return the unfiltered queryset
49
+ if session.is_expired:
50
+ return self
51
+
52
+ # When no new filter data is applied and session is NOT yet expired,
53
+ # return the original queryset
43
54
  return self.bulk_filter(session.data)
44
55
  else:
45
56
  show_form_errors(request, form)
@@ -75,7 +75,6 @@ class SessionController:
75
75
  self._set_modified()
76
76
 
77
77
  def _clean(self) -> None:
78
-
79
78
  if self._TIMEOUT_KEY in self.data and self.is_expired:
80
79
  self.request.session.pop(self.session_key)
81
80
  self._set_modified()
@@ -66,7 +66,8 @@
66
66
  batch_size: this.batch_size
67
67
  });
68
68
 
69
- let url = `${this.endpoint}?${params}`;
69
+ let separator = this.endpoint.includes('?') ? '&' : '?';
70
+ let url = `${this.endpoint}${separator}${params}`;
70
71
  let view = new ViewGlue(url, {});
71
72
 
72
73
  let previous_count = this.loaded_count;
@@ -129,24 +130,13 @@
129
130
  >
130
131
  <div x-ref="content_container"></div>
131
132
 
132
- <div style="height: 10px;" x-ref="infinite_scroll_trigger"></div>
133
- </div>
134
-
135
- <template x-if="show_loading">
136
- <div
137
- class="position-absolute d-flex justify-content-center align-items-center"
138
- style="top: 0; left: 0; right: 0; bottom: 0; background: color-mix(in srgb, var(--app-layer-one) 85%, transparent);"
139
- >
133
+ <div x-cloak x-show="show_loading" class="py-3 text-center">
140
134
  <div class="spinner-border text-app-primary" role="status"></div>
141
135
  </div>
142
- </template>
143
- </div>
144
136
 
145
- <div class="row mt-3">
146
- <div class="col text-start">
147
- <span class="fs-7 text-app-secondary">
148
- Showing <span x-text="loaded_count"></span> of <span x-text="total_count"></span> items
149
- </span>
137
+ <div style="height: 10px;" x-ref="infinite_scroll_trigger"></div>
150
138
  </div>
151
139
  </div>
140
+
141
+ {% include 'django_spire/infinite_scroll/element/footer.html' %}
152
142
  </div>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: django-spire
3
- Version: 0.23.0
3
+ Version: 0.23.2
4
4
  Summary: A project for Django Spire
5
5
  Author-email: Brayden Carlson <braydenc@stratusadv.com>, Nathan Johnson <nathanj@stratusadv.com>
6
6
  License: Copyright (c) 2024 Stratus Advanced Technologies and Contributors.
@@ -1,6 +1,6 @@
1
1
  django_spire/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  django_spire/conf.py,sha256=c5Hs-7lk9T15254tOasiQ2ZTFLQIVJof9_QJDfm1PAI,933
3
- django_spire/consts.py,sha256=xIvLbayXa8bBS1w8s_UdEMqzBVZIdIBVPm-BNoLz090,171
3
+ django_spire/consts.py,sha256=gvinNQud8bYSX-PURLRcfJBJmBVQWlEp4R7rxv9E_y0,171
4
4
  django_spire/exceptions.py,sha256=L5ndRO5ftMmh0pHkO2z_NG3LSGZviJ-dDHNT73SzTNw,48
5
5
  django_spire/settings.py,sha256=B4GPqBGt_dmkt0Ay0j-IP-SZ6mY44m2Ap5kVSON5YLA,1005
6
6
  django_spire/urls.py,sha256=mKeZszb5U4iIGqddMb5Tt5fRC72U2wABEOi6mvOfEBU,656
@@ -355,9 +355,9 @@ django_spire/contrib/progress/static/django_spire/js/contrib/progress/progress.j
355
355
  django_spire/contrib/progress/templates/django_spire/contrib/progress/card/card.html,sha256=2Ajv0UBJEGwc4InVe69aLe2u4K56yh2JAuvO6uH24j8,3353
356
356
  django_spire/contrib/progress/templates/django_spire/contrib/progress/modal/content.html,sha256=oZ7mOxzro5809wSHLe4A90PonAqcr_eVawR_xHKXIt8,3682
357
357
  django_spire/contrib/queryset/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
358
- django_spire/contrib/queryset/enums.py,sha256=FhrwaEZ8Ql3AnImDleJFonp11-ObCZT24bC5fCCVBxE,132
358
+ django_spire/contrib/queryset/enums.py,sha256=nGUHwCVOCBfVXo-lrgyqRoEaMq0ZQAGOWnjALSFPjJU,108
359
359
  django_spire/contrib/queryset/filter_tools.py,sha256=o7OBB3Jjtyoj7aaWspkFKS2bv0BeMIigXz7DVvt6Ueo,1087
360
- django_spire/contrib/queryset/mixins.py,sha256=1F8uZihv4kwhlqNsnDKjol1o2OVaxuzoOZLdQebbrtY,1732
360
+ django_spire/contrib/queryset/mixins.py,sha256=Y_tK9ECr1cb_7AywpNaFKmqxRmNzvNuSCDyqVmfNcCE,2096
361
361
  django_spire/contrib/seeding/__init__.py,sha256=mHKO8a7fCAf70BWYjgyGgBDfssPtb3Pp9IxCVVI_4-M,112
362
362
  django_spire/contrib/seeding/field/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
363
363
  django_spire/contrib/seeding/field/base.py,sha256=SK8EYSsLgMRgosY8bRb3X27RpL7cq55VETf6Q_pYYr4,1198
@@ -409,7 +409,7 @@ django_spire/contrib/service/django_model_service.py,sha256=urQoEcrj2w3zxEILX0nr
409
409
  django_spire/contrib/service/exceptions.py,sha256=cQZitr-CiSJ1Aeah3L4kNYcFcicCGMu5AQtEI3TwiUE,113
410
410
  django_spire/contrib/session/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
411
411
  django_spire/contrib/session/apps.py,sha256=e2lvkf3lZIFYMsgzsdIb97kP3TSYF8W2u26lb0qqZkw,221
412
- django_spire/contrib/session/controller.py,sha256=sa4Pa1mIgcN-njajmF-6jsqJSnrnJssRcWjRgWbk_4Q,2927
412
+ django_spire/contrib/session/controller.py,sha256=wXnBmoRz_HBOvsxjkndv76AEG7itmTwoXZq6LcwPjME,2926
413
413
  django_spire/contrib/session/templatetags/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
414
414
  django_spire/contrib/session/templatetags/session_tags.py,sha256=wVlW5_d6AMsMWqCwCgX39r6nS5NS6vbl7hmi_ZrVKmg,459
415
415
  django_spire/contrib/session/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -665,7 +665,7 @@ django_spire/core/templates/django_spire/forms/elements/list_element.html,sha256
665
665
  django_spire/core/templates/django_spire/forms/elements/value_element.html,sha256=LaOR2ggmf-J_cPCVHjNoD4l_858zHCRA58T_ZB3EIkE,57
666
666
  django_spire/core/templates/django_spire/forms/widgets/json_tree_widget.html,sha256=dykf6xYRZ477i6SgcGR3TSnxDwLsu2p3FR45hEr4DF8,1489
667
667
  django_spire/core/templates/django_spire/infinite_scroll/base.html,sha256=x4JJgXTnWXTRz2laFHBW5jpD4D9sU-P8eAUDgEc3-UU,10875
668
- django_spire/core/templates/django_spire/infinite_scroll/scroll.html,sha256=fF_U1EPoZbkhK0zh-Q7ggrvR12yCsT1UOY2z63uM8es,4668
668
+ django_spire/core/templates/django_spire/infinite_scroll/scroll.html,sha256=osZx9nsCypvnZY3dva_52MoZQRkLK0kOCMnGxHvhsUw,4311
669
669
  django_spire/core/templates/django_spire/infinite_scroll/element/footer.html,sha256=22yxDuYB2vKqaDaMsARStrYTYoHtPGYmK6Xl9XQdwH8,391
670
670
  django_spire/core/templates/django_spire/item/infinite_scroll_item.html,sha256=NMx3jQwtcKJiKtzbQXaXI3eWOtnJFiZhCI13tLTxSnc,1011
671
671
  django_spire/core/templates/django_spire/item/item.html,sha256=9AD6qRcYIb7q-EcmWlRUFiK8XfnmPBSS5NOsXdKEAAA,1217
@@ -1193,8 +1193,8 @@ django_spire/theme/urls/page_urls.py,sha256=S8nkKkgbhG3XHI3uMUL-piOjXIrRkuY2UlM_
1193
1193
  django_spire/theme/views/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1194
1194
  django_spire/theme/views/json_views.py,sha256=PWwVTaty0BVGbj65L5cxex6JNhc-xVAI_rEYjbJWqEM,1893
1195
1195
  django_spire/theme/views/page_views.py,sha256=WenjOa6Welpu3IMolY56ZwBjy4aK9hpbiMNuygjAl1A,3922
1196
- django_spire-0.23.0.dist-info/licenses/LICENSE.md,sha256=tlTbOtgKoy-xAQpUk9gPeh9O4oRXCOzoWdW3jJz0wnA,1091
1197
- django_spire-0.23.0.dist-info/METADATA,sha256=D_Ci76LXS9AAtpSki9idJoi2EBdAta3wPc3OluSfq5A,5127
1198
- django_spire-0.23.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
1199
- django_spire-0.23.0.dist-info/top_level.txt,sha256=xf3QV1e--ONkVpgMDQE9iqjQ1Vg4--_6C8wmO-KxPHQ,13
1200
- django_spire-0.23.0.dist-info/RECORD,,
1196
+ django_spire-0.23.2.dist-info/licenses/LICENSE.md,sha256=tlTbOtgKoy-xAQpUk9gPeh9O4oRXCOzoWdW3jJz0wnA,1091
1197
+ django_spire-0.23.2.dist-info/METADATA,sha256=7x2HFXnglT6gwdbs_JxDzGbWqwZIfxsT6p9dzDCh-AY,5127
1198
+ django_spire-0.23.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
1199
+ django_spire-0.23.2.dist-info/top_level.txt,sha256=xf3QV1e--ONkVpgMDQE9iqjQ1Vg4--_6C8wmO-KxPHQ,13
1200
+ django_spire-0.23.2.dist-info/RECORD,,