Vysloužilým účastníkům povolit změnu údajů bez změny maturity.
This commit is contained in:
parent
c5ac57f8e5
commit
c645074122
2 changed files with 15 additions and 3 deletions
|
@ -233,6 +233,11 @@ class ProfileEditForm(forms.Form):
|
|||
# elif data.get('skola_adresa')=='':
|
||||
# self.add_error('skola_adresa',forms.ValidationError('Je nutné vyplnit adresu školy'))
|
||||
|
||||
class PoMaturiteProfileEditForm(ProfileEditForm):
|
||||
rok_maturity = forms.IntegerField(
|
||||
label='Rok maturity',
|
||||
required=True)
|
||||
|
||||
class VlozReseniForm(forms.Form):
|
||||
#FIXME jen podproblémy daného problému
|
||||
problem = forms.ModelChoiceField(label='Problém',queryset=m.Problem.objects.all())
|
||||
|
|
|
@ -20,13 +20,14 @@ from django.db import transaction
|
|||
from django.core import serializers
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.forms.models import model_to_dict
|
||||
from django import forms
|
||||
|
||||
import seminar.models as s
|
||||
import seminar.models as m
|
||||
from seminar.models import Problem, Cislo, Reseni, Nastaveni, Rocnik, Soustredeni, Organizator, Resitel, Novinky, Soustredeni_Ucastnici, Pohadka, Tema, Clanek, Osoba, Skola # Tohle je stare a chceme se toho zbavit. Pouzivejte s.ToCoChci
|
||||
#from .models import VysledkyZaCislo, VysledkyKCisluZaRocnik, VysledkyKCisluOdjakziva
|
||||
from seminar import utils, treelib
|
||||
from seminar.forms import PrihlaskaForm, LoginForm, ProfileEditForm
|
||||
from seminar.forms import PrihlaskaForm, LoginForm, ProfileEditForm, PoMaturiteProfileEditForm
|
||||
import seminar.forms as f
|
||||
import seminar.templatetags.treenodes as tnltt
|
||||
import seminar.views.views_rest as vr
|
||||
|
@ -1102,10 +1103,16 @@ def resitelEditView(request):
|
|||
prefill_1.update(prefill_3)
|
||||
if 'datum_narozeni' in prefill_1:
|
||||
prefill_1['datum_narozeni'] = str(prefill_1['datum_narozeni'])
|
||||
form = ProfileEditForm(initial=prefill_1)
|
||||
if 'rok_maturity' not in prefill_1 or prefill_1['rok_maturity'] < date.today().year:
|
||||
form = PoMaturiteProfileEditForm(initial=prefill_1)
|
||||
else:
|
||||
form = ProfileEditForm(initial=prefill_1)
|
||||
## Změna údajů a jejich uložení
|
||||
if request.method == 'POST':
|
||||
form = ProfileEditForm(request.POST)
|
||||
if 'rok_maturity' not in prefill_1 or prefill_1['rok_maturity'] < date.today().year:
|
||||
form = PoMaturiteProfileEditForm(request.POST)
|
||||
else:
|
||||
form = ProfileEditForm(request.POST)
|
||||
if form.is_valid():
|
||||
## Změny v osobě
|
||||
fcd = form.cleaned_data
|
||||
|
|
Loading…
Reference in a new issue