From 2444e5f985f6bd3c2e7156ec60f1e7a731b0aae3 Mon Sep 17 00:00:00 2001 From: "Pavel \"LEdoian\" Turinsky" Date: Mon, 8 Jul 2024 22:39:46 +0200 Subject: [PATCH] =?UTF-8?q?Nemus=C3=ADm=20shazovat=20web?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- personalni/views.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/personalni/views.py b/personalni/views.py index 5e5ad22c..e7cb4f48 100644 --- a/personalni/views.py +++ b/personalni/views.py @@ -4,7 +4,7 @@ from django.views import generic from django.db.models import Q, Count, Min from django.views.decorators.debug import sensitive_post_parameters from django.views.generic.base import TemplateView -from django.contrib.auth.models import User, Permission, Group +from django.contrib.auth.models import User, Permission, Group, AnonymousUser from django.contrib.auth.mixins import LoginRequiredMixin from django.db import transaction from django.http import HttpResponse @@ -318,6 +318,12 @@ def prihlaskaView(request): # Jen hloupé rozhazovátko def profilView(request): user = request.user + if not isinstance(user, AnonymousUser) and m.Osoba.objects.filter(user=user).count() != 1: + # m.Osoba.objects.get() v ostatních views selže + return HttpResponse(render(request, "universal.html", { + 'title': 'Krize identity.', + 'raw_html': r'
Zvláštní pocit, že jo?
[…]
Co to znamená?
— Že ti MaMweb neumí říct, kdo jsi.
A Admin ano?
— V tom je rozdíl.
— Matrix (1999), parafrázováno', + })) if user.has_perm('auth.org'): return OrgoRozcestnikView.as_view()(request) if user.has_perm('auth.resitel'):