summaryrefslogtreecommitdiff
path: root/ishtar_common/forms_common.py
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/forms_common.py')
-rw-r--r--ishtar_common/forms_common.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/ishtar_common/forms_common.py b/ishtar_common/forms_common.py
index 2df825594..242607732 100644
--- a/ishtar_common/forms_common.py
+++ b/ishtar_common/forms_common.py
@@ -48,6 +48,7 @@ from .forms import FinalForm, FormSet, reverse_lazy, name_validator, \
FormSetWithDeleteSwitches, BSForm, get_data_from_formset, \
file_size_validator, HistorySelect, CustomFormSearch, QAForm, IshtarForm, \
MultiSearchForm, LockForm
+from ishtar_common.data_importer import ImporterError
from ishtar_common.utils import is_downloadable, clean_session_cache, \
max_size_help
@@ -230,7 +231,7 @@ class TargetKeyForm(forms.ModelForm):
self.fields['value'].choices = list(
instance.target.get_choices())
self.fields['value'].choices.insert(
- 1, (self.NULL_VALUE, _(u"Set to NULL")))
+ 1, (self.NULL_VALUE, _("Set to NULL")))
self.fields['key'].required = False
self.fields['target'].required = False
@@ -267,7 +268,10 @@ class TargetKeyForm(forms.ModelForm):
return self.cleaned_data['key']
def save(self, commit=True):
- super(TargetKeyForm, self).save(commit)
+ try:
+ super(TargetKeyForm, self).save(commit)
+ except ImporterError:
+ return
if not self.cleaned_data.get('value') or not self.user:
return
if self.cleaned_data['value'] == self.NULL_VALUE: