@ -4,7 +4,7 @@ from django.views import generic
from django . db . models import Q , Count , Min
from django . db . models import Q , Count , Min
from django . views . decorators . debug import sensitive_post_parameters
from django . views . decorators . debug import sensitive_post_parameters
from django . views . generic . base import TemplateView
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 . contrib . auth . mixins import LoginRequiredMixin
from django . db import transaction
from django . db import transaction
from django . http import HttpResponse
from django . http import HttpResponse
@ -318,6 +318,12 @@ def prihlaskaView(request):
# Jen hloupé rozhazovátko
# Jen hloupé rozhazovátko
def profilView ( request ) :
def profilView ( request ) :
user = request . user
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 ' <blockquote>Zvláštní pocit, že jo?<br>[…]<br>Co to znamená?<br>— Že ti MaMweb neumí říct, kdo jsi.<br>A <a href= " /admin " >Admin</a> ano?<br>— V tom je rozdíl.</blockquote> — Matrix (1999), parafrázováno ' ,
} ) )
if user . has_perm ( ' auth.org ' ) :
if user . has_perm ( ' auth.org ' ) :
return OrgoRozcestnikView . as_view ( ) ( request )
return OrgoRozcestnikView . as_view ( ) ( request )
if user . has_perm ( ' auth.resitel ' ) :
if user . has_perm ( ' auth.resitel ' ) :