Zeitpunkt Nutzer Delta Tröts TNR Titel Version maxTL Sa 05.10.2024 00:02:10 22.297 +1 3.143.539 141,0 Mastodon 4.2.13 500 Fr 04.10.2024 00:00:00 22.296 +2 3.142.061 140,9 Mastodon 4.2.13 500 Do 03.10.2024 00:00:13 22.294 -2 3.139.667 140,8 Mastodon 4.2.13 500 Mi 02.10.2024 00:00:47 22.296 0 3.137.621 140,7 Mastodon 4.2.13 500 Di 01.10.2024 00:00:30 22.296 +1 3.135.043 140,6 Mastodon 4.2.13 500 Mo 30.09.2024 00:01:12 22.295 +2 3.132.761 140,5 Mastodon 4.2.12 500 So 29.09.2024 00:01:07 22.293 +1 3.130.131 140,4 Mastodon 4.2.12 500 Sa 28.09.2024 00:01:07 22.292 +3 3.127.701 140,3 Mastodon 4.2.12 500 Fr 27.09.2024 00:00:48 22.289 +2 3.125.060 140,2 Mastodon 4.2.12 500 Do 26.09.2024 00:00:25 22.287 0 3.122.662 140,1 Mastodon 4.2.12 500
Oliver Andrich (@oliverandrich) · 05/2024 · Tröts: 699 · Folger: 484
Sa 05.10.2024 20:09
I am not sure, if I enjoy this code. It basically does, what I want it to do - assure that my LoginView is not requiring a login even if Django 5.1 is used and the LoginRequiredMiddleware is applied.
I have to sleep about it. And tips are welcome. May be there is in easier way to conditionally apply a decorator depending on the Django version.
Screenshot of the source to dynamically apply the new login_not_required decorator from Django 5.1 in case the project is running 5.1 or applying a noop decorator, that simply does nothing. def noop_decorator(func): @wraps(func) def wrapper(*args, **kwargs): return func(*args, **kwargs) return wrapper if django.VERSION >= (5, 1): login_not_required = import_string("django.contrib.auth.decorators.login_not_required") else: login_not_required = noop_decorator @method_decorator(csrf_protect, name="dispatch") @method_decorator(never_cache, name="dispatch") @method_decorator(login_not_required, name="dispatch") class LoginView(FormView): ...
[Öffentlich] Antw.: 0 Wtrl.: 2 Fav.: 1 · via Ivory for Mac