I řešitelskou groupu chceme při registraci dát…

This commit is contained in:
Pavel "LEdoian" Turinsky 2021-09-02 15:43:03 +02:00
parent fedb6f7b1c
commit 7b95ea9f89

View file

@ -14,7 +14,7 @@ from django.views.generic.edit import FormView, CreateView
from django.views.generic.base import TemplateView, RedirectView from django.views.generic.base import TemplateView, RedirectView
from django.contrib.auth import authenticate, login, get_user_model, logout from django.contrib.auth import authenticate, login, get_user_model, logout
from django.contrib.auth import views as auth_views from django.contrib.auth import views as auth_views
from django.contrib.auth.models import User, Permission from django.contrib.auth.models import User, Permission, Group
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.core import serializers from django.core import serializers
@ -1189,6 +1189,8 @@ def prihlaskaView(request):
u.save() u.save()
resitel_perm = Permission.objects.filter(codename__exact='resitel').first() resitel_perm = Permission.objects.filter(codename__exact='resitel').first()
u.user_permissions.add(resitel_perm) u.user_permissions.add(resitel_perm)
resitel_grp = Group.objects.filter(codename__exact='resitel').first()
u.user_groups.add(resitel_grp)
o = Osoba( o = Osoba(
jmeno = fcd['jmeno'], jmeno = fcd['jmeno'],