diff options
Diffstat (limited to 'archaeological_operations/forms.py')
-rw-r--r-- | archaeological_operations/forms.py | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py index 32b37e4c3..529a0c2fb 100644 --- a/archaeological_operations/forms.py +++ b/archaeological_operations/forms.py @@ -416,7 +416,9 @@ class RecordRelationsForm(ManageOldType, forms.Form): cleaned_data.get('right_record', None)): raise forms.ValidationError( _(u"You should select a relation type.")) - if str(cleaned_data.get('right_record')) == str(self.left_record.pk): + if self.left_record and \ + str(cleaned_data.get('right_record')) == str( + self.left_record.pk): raise forms.ValidationError( _(u"An operation cannot be related to herself.")) return cleaned_data @@ -481,7 +483,8 @@ class OperationSelect(TableSelect): year = forms.IntegerField(label=_("Year")) operation_code = forms.IntegerField(label=_(u"Numeric reference")) if settings.COUNTRY == 'fr': - code_patriarche = forms.IntegerField( + code_patriarche = forms.CharField( + max_length=500, widget=OAWidget, label="Code PATRIARCHE") towns = get_town_field() @@ -769,9 +772,10 @@ class OperationFormGeneral(ManageOldType, forms.Form): } pk = forms.IntegerField(required=False, widget=forms.HiddenInput) if settings.COUNTRY == 'fr': - code_patriarche = forms.IntegerField(label=u"Code PATRIARCHE", - widget=OAWidget, - required=False) + code_patriarche = forms.CharField(label=u"Code PATRIARCHE", + max_length=500, + widget=OAWidget, + required=False) common_name = forms.CharField(label=_(u"Generic name"), required=False, max_length=500, widget=forms.Textarea) address = forms.CharField(label=_(u"Address / Locality"), required=False, @@ -934,7 +938,7 @@ class OperationFormGeneral(ManageOldType, forms.Form): if 'pk' in cleaned_data and cleaned_data['pk']: ops = ops.exclude(pk=cleaned_data['pk']) if ops.count(): - msg = u"Ce code Patriarche a déjà été affecté à une "\ + msg = u"Ce code OA a déjà été affecté à une "\ u"autre opération" raise forms.ValidationError(msg) # manage unique operation ID @@ -1280,7 +1284,8 @@ class OperationSourceSelect(SourceSelect): operation__operation_code = forms.IntegerField( label=_(u"Numeric reference")) if settings.COUNTRY == 'fr': - operation__code_patriarche = forms.IntegerField( + operation__code_patriarche = forms.CharField( + max_length=500, widget=OAWidget, label="Code PATRIARCHE") operation__towns = get_town_field(label=_(u"Operation's town")) @@ -1312,7 +1317,8 @@ class AdministrativeActOpeSelect(TableSelect): if settings.COUNTRY == 'fr': ref_sra = forms.CharField(label=u"Autre référence", max_length=15) - operation__code_patriarche = forms.IntegerField( + operation__code_patriarche = forms.CharField( + max_length=500, widget=OAWidget, label="Code PATRIARCHE") act_type = forms.ChoiceField(label=_("Act type"), choices=[]) |