|
|
@ -10,6 +10,7 @@ from django.http import Http404,HttpResponseBadRequest,HttpResponseRedirect |
|
|
|
from django.db.models import Q |
|
|
|
from django.views.decorators.csrf import ensure_csrf_cookie |
|
|
|
from django.contrib.auth import authenticate, login, get_user_model, logout |
|
|
|
from django.contrib.auth import views as auth_views |
|
|
|
from django.contrib.auth.models import User |
|
|
|
from django.contrib.auth.mixins import LoginRequiredMixin |
|
|
|
from django.db import transaction |
|
|
@ -1154,3 +1155,14 @@ class SkolaAutocomplete(autocomplete.Select2QuerySetView): |
|
|
|
# Q(user__last_name__isstartswith=query)) |
|
|
|
# |
|
|
|
# return qs |
|
|
|
|
|
|
|
# FIXME: Tohle asi vlastně vůbec nepatří do aplikace 'seminar' |
|
|
|
class LoginView(auth_views.LoginView): |
|
|
|
# Jen vezmeme vestavěný a dáme mu vhodný template a přesměrovací URL |
|
|
|
template_name = 'seminar/login.html' |
|
|
|
|
|
|
|
# Přesměrovací URL má být v kontextu: |
|
|
|
def get_context_data(self, **kwargs): |
|
|
|
ctx = super().get_context_data(**kwargs) |
|
|
|
ctx['next'] = reverse('titulni_strana') |
|
|
|
return ctx |
|
|
|