summaryrefslogtreecommitdiff
path: root/archaeological_operations/forms.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@proxience.com>2013-07-16 12:20:04 +0000
committerÉtienne Loks <etienne.loks@proxience.com>2013-07-16 12:20:04 +0000
commitbfe42b078e8268ec0ce6c0d142987385777f4513 (patch)
tree5c776c1da0f0d534315780b199faa7b4153071a8 /archaeological_operations/forms.py
parenta5b0e2882842f28f7e4e3944ab81192409c9c61c (diff)
parente92ff84e83b0d3f6bf632010b93ecd2f75cd676c (diff)
downloadIshtar-bfe42b078e8268ec0ce6c0d142987385777f4513.tar.bz2
Ishtar-bfe42b078e8268ec0ce6c0d142987385777f4513.zip
Merge branch 'master' of lysithea.proxience.net:/home/proxience/git/ishtar
Diffstat (limited to 'archaeological_operations/forms.py')
-rw-r--r--archaeological_operations/forms.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py
index e545ff5fa..c1003dfe9 100644
--- a/archaeological_operations/forms.py
+++ b/archaeological_operations/forms.py
@@ -114,10 +114,7 @@ class OperationSelect(TableSelect):
common_name = forms.CharField(label=_(u"Name (full text search)"),
max_length=30)
if settings.COUNTRY == 'fr':
- code_patriarche = forms.IntegerField(
- widget=widgets.JQueryAutoComplete("/" + settings.URL_PATH + \
- 'autocomplete-patriarche/'),
- label="Code PATRIARCHE")
+ code_patriarche = forms.IntegerField(label="Code PATRIARCHE")
towns = get_town_field()
operation_type = forms.ChoiceField(label=_(u"Operation type"),
choices=[])
@@ -280,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):