diff options
-rw-r--r-- | archaeological_operations/forms.py | 14 | ||||
-rw-r--r-- | archaeological_operations/import_from_csv.py | 2 |
2 files changed, 9 insertions, 7 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): diff --git a/archaeological_operations/import_from_csv.py b/archaeological_operations/import_from_csv.py index 3f29bcb95..ff3bd11f4 100644 --- a/archaeological_operations/import_from_csv.py +++ b/archaeological_operations/import_from_csv.py @@ -415,7 +415,7 @@ def parse_ope_name(value): def parse_ha(value): value = parse_string(value) try: - value = float(value) + value = float(value) * 10000 except: value = None return value |