|
@ -10,8 +10,9 @@ from django.http import Http404,HttpResponseBadRequest,HttpResponseRedirect |
|
|
from django.db.models import Q |
|
|
from django.db.models import Q |
|
|
from django.views.decorators.csrf import ensure_csrf_cookie |
|
|
from django.views.decorators.csrf import ensure_csrf_cookie |
|
|
from django.contrib.auth import authenticate, login, get_user_model |
|
|
from django.contrib.auth import authenticate, login, get_user_model |
|
|
|
|
|
from dal import autocomplete |
|
|
|
|
|
|
|
|
from .models import Problem, Cislo, Reseni, Nastaveni, Rocnik, Soustredeni, Organizator, Resitel, Novinky, Soustredeni_Ucastnici, Pohadka, Tema, Clanek, Osoba |
|
|
from .models import Problem, Cislo, Reseni, Nastaveni, Rocnik, Soustredeni, Organizator, Resitel, Novinky, Soustredeni_Ucastnici, Pohadka, Tema, Clanek, Osoba, Skola |
|
|
#from .models import VysledkyZaCislo, VysledkyKCisluZaRocnik, VysledkyKCisluOdjakziva |
|
|
#from .models import VysledkyZaCislo, VysledkyKCisluZaRocnik, VysledkyKCisluOdjakziva |
|
|
from . import utils |
|
|
from . import utils |
|
|
from .unicodecsv import UnicodeWriter |
|
|
from .unicodecsv import UnicodeWriter |
|
@ -1011,7 +1012,11 @@ def prihlaskaView(request): |
|
|
|
|
|
|
|
|
r.save() |
|
|
r.save() |
|
|
r.osoba = o |
|
|
r.osoba = o |
|
|
#TODO doplnit skolu |
|
|
if form.cleaned_data.get('skola'): |
|
|
|
|
|
r.skola = form.cleaned_data['skola'] |
|
|
|
|
|
else: |
|
|
|
|
|
pass |
|
|
|
|
|
#TODO doplnit skolu, kdyz neni v seznamu |
|
|
r.save() |
|
|
r.save() |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1025,6 +1030,19 @@ def prihlaskaView(request): |
|
|
|
|
|
|
|
|
return render(request, 'seminar/prihlaska.html', {'form': form}) |
|
|
return render(request, 'seminar/prihlaska.html', {'form': form}) |
|
|
|
|
|
|
|
|
|
|
|
class SkolaAutocomplete(autocomplete.Select2QuerySetView): |
|
|
|
|
|
def get_queryset(self): |
|
|
|
|
|
# Don't forget to filter out results depending on the visitor ! |
|
|
|
|
|
qs = Skola.objects.all() |
|
|
|
|
|
if self.q: |
|
|
|
|
|
qs = qs.filter( |
|
|
|
|
|
Q(nazev__istartswith=self.q)| |
|
|
|
|
|
Q(kratky_nazev__istartswith=self.q)| |
|
|
|
|
|
Q(ulice__istartswith=self.q)| |
|
|
|
|
|
Q(mesto__istartswith=self.q)) |
|
|
|
|
|
|
|
|
|
|
|
return qs |
|
|
|
|
|
|
|
|
# Ceka na autocomplete v3 |
|
|
# Ceka na autocomplete v3 |
|
|
# class OrganizatorAutocomplete(autocomplete.Select2QuerySetView): |
|
|
# class OrganizatorAutocomplete(autocomplete.Select2QuerySetView): |
|
|
# def get_queryset(self): |
|
|
# def get_queryset(self): |
|
|