diff options
| author | Étienne Loks <etienne.loks@proxience.com> | 2014-10-17 01:47:53 +0200 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@proxience.com> | 2014-10-17 01:47:53 +0200 | 
| commit | ed97e2751a7e22f4df09c9ce4253f431b98b7e03 (patch) | |
| tree | 9a7da668af18ab59c0fb283568d306c67601ac2f /archaeological_operations/forms.py | |
| parent | e96320dc97ee2befd7deed6e518b9237a1441727 (diff) | |
| download | Ishtar-ed97e2751a7e22f4df09c9ce4253f431b98b7e03.tar.bz2 Ishtar-ed97e2751a7e22f4df09c9ce4253f431b98b7e03.zip | |
Update french translation
Diffstat (limited to 'archaeological_operations/forms.py')
| -rw-r--r-- | archaeological_operations/forms.py | 31 | 
1 files changed, 19 insertions, 12 deletions
| diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py index d31d5c542..78e5a4ed4 100644 --- a/archaeological_operations/forms.py +++ b/archaeological_operations/forms.py @@ -35,7 +35,11 @@ from django.utils.safestring import mark_safe  from ishtar_common.models import valid_id, PersonType, Person, Town, \                               DocumentTemplate, Organization, OrganizationType -from archaeological_files.models import File + +FILES_AVAILABLE = 'archaeological_files' in settings.INSTALLED_APPS + +if FILES_AVAILABLE: +    from archaeological_files.models import File  import models  from widgets import ParcelWidget, SelectParcelWidget @@ -292,14 +296,15 @@ class OperationCodeInput(forms.TextInput):                                 'url':reverse_lazy('get_available_operation_code')}          return mark_safe(rendered + js) -class OperationFormFileChoice(forms.Form): -    form_label = _(u"Associated file") -    associated_models = {'associated_file':File,} -    currents = {'associated_file':File} -    associated_file = forms.IntegerField(label=_(u"Archaelogical file"), -         widget=widgets.JQueryAutoComplete(reverse_lazy('autocomplete-file'), -                                           associated_model=File), -         validators=[valid_id(File)], required=False) +if FILES_AVAILABLE: +    class OperationFormFileChoice(forms.Form): +        form_label = _(u"Associated file") +        associated_models = {'associated_file':File,} +        currents = {'associated_file':File} +        associated_file = forms.IntegerField(label=_(u"Archaelogical file"), +             widget=widgets.JQueryAutoComplete(reverse_lazy('autocomplete-file'), +                                               associated_model=File), +             validators=[valid_id(File)], required=False)  class OperationFormGeneral(forms.Form):      form_label = _(u"General") @@ -419,9 +424,10 @@ class OperationFormGeneral(forms.Form):          return self.cleaned_data  class OperationFormModifGeneral(OperationFormGeneral): -    currents = {'associated_file':File}      operation_code = forms.IntegerField(label=_(u"Operation code")) -    associated_file = forms.IntegerField(label=_(u"Archaelogical file"), +    if FILES_AVAILABLE: +        currents = {'associated_file':File} +        associated_file = forms.IntegerField(label=_(u"Archaelogical file"),           widget=widgets.JQueryAutoComplete(reverse_lazy('autocomplete-file'),                                             associated_model=File),           validators=[valid_id(File)], required=False) @@ -435,7 +441,8 @@ class OperationFormModifGeneral(OperationFormGeneral):  OperationFormModifGeneral.associated_models = \                                  OperationFormGeneral.associated_models.copy() -OperationFormModifGeneral.associated_models['associated_file'] = File +if FILES_AVAILABLE: +    OperationFormModifGeneral.associated_models['associated_file'] = File  class OperationFormPreventive(forms.Form): | 
