fnp
/
edumed.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
7095c25
)
fix for wannabe hackers
author
Jan Szejko
<janek37@gmail.com>
Tue, 30 Jan 2018 09:38:44 +0000
(10:38 +0100)
committer
Jan Szejko
<janek37@gmail.com>
Tue, 30 Jan 2018 09:38:44 +0000
(10:38 +0100)
stage2/forms.py
patch
|
blob
|
history
diff --git
a/stage2/forms.py
b/stage2/forms.py
index
ee25a03
..
b1bcac9
100644
(file)
--- a/
stage2/forms.py
+++ b/
stage2/forms.py
@@
-59,7
+59,10
@@
class AssignmentFieldForm(forms.Form):
if self.type == 'options':
value = self.cleaned_data['value']
if value:
if self.type == 'options':
value = self.cleaned_data['value']
if value:
- option = FieldOption.objects.get(id=int(value))
+ try:
+ option = FieldOption.objects.get(id=int(value))
+ except (FieldOption.DoesNotExist, ValueError):
+ raise forms.ValidationError(u'Nieprawidłowa wartość.')
if option.answer != self.answer and option.answer is not None:
raise forms.ValidationError(u'Ta opcja została już wybrana przez kogoś innego.')
return option
if option.answer != self.answer and option.answer is not None:
raise forms.ValidationError(u'Ta opcja została już wybrana przez kogoś innego.')
return option