summaryrefslogtreecommitdiff
path: root/archaeological_operations/forms.py
diff options
context:
space:
mode:
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
commitb8e826cc4b5be3d935f647b7b74e202578f5e4e8 (patch)
tree9a7da668af18ab59c0fb283568d306c67601ac2f /archaeological_operations/forms.py
parent5134f84b99674294d60d90d74ca979afd2ee40ec (diff)
downloadIshtar-b8e826cc4b5be3d935f647b7b74e202578f5e4e8.tar.bz2
Ishtar-b8e826cc4b5be3d935f647b7b74e202578f5e4e8.zip
Update french translation
Diffstat (limited to 'archaeological_operations/forms.py')
-rw-r--r--archaeological_operations/forms.py31
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):