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.py24
1 files changed, 17 insertions, 7 deletions
diff --git a/ishtar_common/forms_common.py b/ishtar_common/forms_common.py
index d8a4523ab..16c9dd52d 100644
--- a/ishtar_common/forms_common.py
+++ b/ishtar_common/forms_common.py
@@ -45,7 +45,7 @@ from .forms import FinalForm, FormSet, reverse_lazy, name_validator, \
TableSelect, ManageOldType, CustomForm, FieldType, FormHeader, \
FormSetWithDeleteSwitches, BSForm, get_data_from_formset, \
file_size_validator, HistorySelect, CustomFormSearch, QAForm, IshtarForm, \
- MultiSearchForm
+ MultiSearchForm, LockForm
from ishtar_common.utils import is_downloadable, clean_session_cache, \
max_size_help
@@ -1371,7 +1371,7 @@ class DocumentSelect(HistorySelect):
}
-class DocumentFormSelection(CustomFormSearch):
+class DocumentFormSelection(LockForm, CustomFormSearch):
SEARCH_AND_SELECT = True
form_label = _(u"Document search")
associated_models = {'pk': models.Document}
@@ -1386,11 +1386,21 @@ class DocumentFormSelection(CustomFormSearch):
),
validators=[models.valid_id(models.Document)])
- def clean(self):
- cleaned_data = self.cleaned_data
- if 'pk' not in cleaned_data or not cleaned_data['pk']:
- raise forms.ValidationError(_(u"You should select an item."))
- return cleaned_data
+
+class DocumentFormMultiSelection(LockForm, MultiSearchForm):
+ form_label = _(u"Document search")
+ associated_models = {'pks': models.Document}
+ pk_key = 'pks'
+
+ pk = forms.CharField(
+ label="", required=False,
+ widget=widgets.DataTable(
+ reverse_lazy('get-document'), DocumentSelect,
+ models.Document,
+ multiple_select=True,
+ gallery=True
+ ),
+ validators=[models.valid_ids(models.Document)])
class QADocumentFormMulti(QAForm):