diff options
author | Étienne Loks <etienne.loks@peacefrogs.net> | 2013-07-16 12:51:42 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@peacefrogs.net> | 2013-07-16 12:51:42 +0200 |
commit | ba614d2ed285c6aba0c2e8b7d68ea19659c16447 (patch) | |
tree | 5c776c1da0f0d534315780b199faa7b4153071a8 /archaeological_operations/forms.py | |
parent | 357828a082473f098d006f91ec8d4fe308969f95 (diff) | |
download | Ishtar-ba614d2ed285c6aba0c2e8b7d68ea19659c16447.tar.bz2 Ishtar-ba614d2ed285c6aba0c2e8b7d68ea19659c16447.zip |
Manage strange session error.
Diffstat (limited to 'archaeological_operations/forms.py')
-rw-r--r-- | archaeological_operations/forms.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py index a801b60a6..c1003dfe9 100644 --- a/archaeological_operations/forms.py +++ b/archaeological_operations/forms.py @@ -277,9 +277,14 @@ class OperationFormGeneral(forms.Form): if ops.count(): max_val = models.Operation.objects.filter(year=year).aggregate( Max('operation_code'))["operation_code__max"] - raise forms.ValidationError(_(u"Operation code already exist for " + msg = '' + if year and max_val: + msg = _(u"Operation code already exist for " u"year: %(year)d - use a value bigger than %(last_val)d") % { - 'year':year, 'last_val':max_val}) + 'year':year, 'last_val':max_val} + else: + msg = _(u"Bad operation code") + raise forms.ValidationError(msg) return self.cleaned_data class OperationFormPreventive(forms.Form): |