accrete 0.0.152__py3-none-any.whl → 0.0.153__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.
- accrete/contrib/ui/middleware.py +8 -0
- accrete/contrib/user/views.py +9 -1
- {accrete-0.0.152.dist-info → accrete-0.0.153.dist-info}/METADATA +1 -1
- {accrete-0.0.152.dist-info → accrete-0.0.153.dist-info}/RECORD +6 -6
- {accrete-0.0.152.dist-info → accrete-0.0.153.dist-info}/WHEEL +0 -0
- {accrete-0.0.152.dist-info → accrete-0.0.153.dist-info}/licenses/LICENSE +0 -0
accrete/contrib/ui/middleware.py
CHANGED
@@ -14,6 +14,8 @@ class HtmxRedirectMiddleware(MiddlewareMixin):
|
|
14
14
|
|
15
15
|
@staticmethod
|
16
16
|
def process_response(request, response):
|
17
|
+
if getattr(request, 'skip_htmx_redirect_middleware', False):
|
18
|
+
return response
|
17
19
|
is_htmx = request.headers.get('HX-Request', 'false') == 'true'
|
18
20
|
if not is_htmx:
|
19
21
|
return response
|
@@ -23,7 +25,13 @@ class HtmxRedirectMiddleware(MiddlewareMixin):
|
|
23
25
|
response.status_code = 200
|
24
26
|
header = 'HX-Location' if is_redirect else 'HX-Redirect'
|
25
27
|
response[header] = response['Location']
|
28
|
+
return response
|
29
|
+
|
26
30
|
|
31
|
+
class HtmxTriggerMiddleware(MiddlewareMixin):
|
32
|
+
|
33
|
+
@staticmethod
|
34
|
+
def process_response(request, response):
|
27
35
|
tenant = get_tenant()
|
28
36
|
trigger = {'setTenant': tenant and tenant.id or 0}
|
29
37
|
res_trigger = response.get('HX-Trigger')
|
accrete/contrib/user/views.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
from django.contrib.auth.forms import AuthenticationForm
|
2
2
|
from django.contrib.auth import views, update_session_auth_hash
|
3
3
|
from django.contrib.auth.decorators import login_required
|
4
|
-
from django.http import HttpResponseForbidden
|
4
|
+
from django.http import HttpResponseForbidden, HttpResponseRedirect
|
5
5
|
from django.shortcuts import redirect, render, resolve_url
|
6
6
|
from django.utils.translation import gettext_lazy as _
|
7
7
|
from django.conf import settings
|
@@ -32,6 +32,14 @@ class LoginView(views.LoginView):
|
|
32
32
|
|
33
33
|
class LogoutView(views.LogoutView):
|
34
34
|
|
35
|
+
def post(self, request, *args, **kwargs):
|
36
|
+
request.skip_htmx_redirect_middleware = True
|
37
|
+
res = super().post(request, *args, **kwargs)
|
38
|
+
if isinstance(res, HttpResponseRedirect):
|
39
|
+
res.headers['HX-Redirect'] = res.url
|
40
|
+
res.status_code = 200
|
41
|
+
return res
|
42
|
+
|
35
43
|
def get_success_url(self):
|
36
44
|
return resolve_url(settings.LOGIN_URL)
|
37
45
|
|
@@ -65,7 +65,7 @@ accrete/contrib/ui/admin.py,sha256=MKShWrFexu9_k-lcCAwn1i1SlKqFV2ScCLo_pU5dX4E,2
|
|
65
65
|
accrete/contrib/ui/apps.py,sha256=E0ao2ox6PQ3ldfeR17FXJUUJuGiWjm2DPCxHbPXGzls,152
|
66
66
|
accrete/contrib/ui/filter.py,sha256=WWELsSZF-v7FxAWw1gGvYHFBB0BhmQWuWacI_joTKas,13703
|
67
67
|
accrete/contrib/ui/forms.py,sha256=k2C1O55CDE6uQiIoE4URtkOPT_TP_W0lpHmUVVqlWFo,2023
|
68
|
-
accrete/contrib/ui/middleware.py,sha256=
|
68
|
+
accrete/contrib/ui/middleware.py,sha256=fVjKeDXnGiJw7NRYZK3nCkj7g-MAainiBl-VhpE3XdQ,1792
|
69
69
|
accrete/contrib/ui/models.py,sha256=VcUZzfZCxUpAPXgZUy9PaSx9IZ1C0wNKWOZUNJRm-lQ,3225
|
70
70
|
accrete/contrib/ui/response.py,sha256=9ecshf8GEg2nGN42b4UlS5r89Z2AESX3vXfR4fRxQek,13880
|
71
71
|
accrete/contrib/ui/tests.py,sha256=mrbGGRNg5jwbTJtWWa7zSKdDyeB4vmgZCRc2nk6VY-g,60
|
@@ -238,7 +238,7 @@ accrete/contrib/user/middleware.py,sha256=qblcujwJsthopagyT-hPFq4HsMyGt-VvqZw5TQ
|
|
238
238
|
accrete/contrib/user/models.py,sha256=TDED3rTF_5H6u65As6h94DrptW7wMJjUUzuvVkNedR0,6338
|
239
239
|
accrete/contrib/user/tests.py,sha256=mrbGGRNg5jwbTJtWWa7zSKdDyeB4vmgZCRc2nk6VY-g,60
|
240
240
|
accrete/contrib/user/urls.py,sha256=_fBa--3NfyYN10Td7PGHpetJYy42SMqTyCCXhgynkEQ,407
|
241
|
-
accrete/contrib/user/views.py,sha256=
|
241
|
+
accrete/contrib/user/views.py,sha256=u0lJ3ZWMKpgcx8iF8W0LVGP2Cu4VtkIdEiuko2rBBms,4257
|
242
242
|
accrete/contrib/user/locale/de/LC_MESSAGES/django.mo,sha256=p3rgUg6WltAVIMkQsjvjBqTsd_usLhSr1GH4Cyltc2c,433
|
243
243
|
accrete/contrib/user/locale/de/LC_MESSAGES/django.po,sha256=f_Nxpo3HTm2L3f3zoHLfeWsZ-4IQp_EEVSku6TCZSvw,1870
|
244
244
|
accrete/contrib/user/migrations/0001_initial.py,sha256=JWfM9PcMDfkJUdCjLWuWieGs6643qP0KdbCyr5uAZoY,2950
|
@@ -287,7 +287,7 @@ accrete/utils/forms.py,sha256=naV4urdfvmpxcx5Vf3Fo72M5Fy8DjGg5-vkysMKptbA,3914
|
|
287
287
|
accrete/utils/log.py,sha256=BH0MBDweAjx30wGBO4F3sFhbgkSoEs7T1lLLjlYZNnA,407
|
288
288
|
accrete/utils/models.py,sha256=2xTacvcpmDK_Bp4rAK7JdVLf8HU009LYNJ6eSpMgYZI,1014
|
289
289
|
accrete/utils/views.py,sha256=mHfcKNDOiq-38LQ6tz9pDPQt-xs03b2qMxwJClprqu8,5022
|
290
|
-
accrete-0.0.
|
291
|
-
accrete-0.0.
|
292
|
-
accrete-0.0.
|
293
|
-
accrete-0.0.
|
290
|
+
accrete-0.0.153.dist-info/METADATA,sha256=jCzOeN2PnIwJf6visBRBwKktjMF3Vres9bclED9euzQ,4953
|
291
|
+
accrete-0.0.153.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
292
|
+
accrete-0.0.153.dist-info/licenses/LICENSE,sha256=vHwb4Qnv8UfYKFiCWyTuRGsi49x19UQwHRCky3b2_NE,1057
|
293
|
+
accrete-0.0.153.dist-info/RECORD,,
|
File without changes
|
File without changes
|