From 357828a082473f098d006f91ec8d4fe308969f95 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 16 Jul 2013 11:17:49 +0200 Subject: Operation search: remove autocomplete for partriarche --- archaeological_operations/forms.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'archaeological_operations/forms.py') diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py index e545ff5fa..a801b60a6 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=[]) -- cgit v1.2.3 From ba614d2ed285c6aba0c2e8b7d68ea19659c16447 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 16 Jul 2013 12:51:42 +0200 Subject: Manage strange session error. --- archaeological_operations/forms.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'archaeological_operations/forms.py') 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): -- cgit v1.2.3