Browse Source

Prototyp formulare.

export_seznamu_prednasek
parent
commit
8ce9475800
  1. 1
      seminar/urls.py
  2. 22
      seminar/views.py

1
seminar/urls.py

@ -104,6 +104,7 @@ urlpatterns = [
staff_member_required(views.texUploadView),
name='seminar_tex_upload'
),
url(r'^prihlaska/$',views.get_name),
# Ceka na autocomplete v3
# url(r'^autocomplete/organizatori/$',

22
seminar/views.py

@ -6,7 +6,7 @@ from django.core.urlresolvers import reverse
from django.core.exceptions import PermissionDenied, ObjectDoesNotExist
from django.views import generic
from django.utils.translation import ugettext as _
from django.http import Http404,HttpResponseBadRequest
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
@ -15,6 +15,7 @@ from .models import Problem, Cislo, Reseni, Nastaveni, Rocnik, Soustredeni, Orga
from .models import VysledkyZaCislo, VysledkyKCisluZaRocnik, VysledkyKCisluOdjakziva
from . import utils
from .unicodecsv import UnicodeWriter
from .forms import NameForm
from datetime import timedelta, date, datetime
from itertools import groupby
@ -932,6 +933,25 @@ def texDownloadView(request, rocnik, cislo):
cislo.save()
return JsonResponse(response)
## Formulare
def get_name(request):
# if this is a POST request we need to process the form data
if request.method == 'POST':
# create a form instance and populate it with data from the request:
form = NameForm(request.POST)
# check whether it's valid:
if form.is_valid():
# process the data in form.cleaned_data as required
# ...
# redirect to a new URL:
return HttpResponseRedirect('/thanks/')
# if a GET (or any other method) we'll create a blank form
else:
form = NameForm()
return render(request, 'seminar/prihlaska.html', {'form': form})
# Ceka na autocomplete v3
# class OrganizatorAutocomplete(autocomplete.Select2QuerySetView):

Loading…
Cancel
Save