summaryrefslogtreecommitdiff
path: root/ishtar_common/forms_common.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2018-06-01 15:50:52 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2018-06-12 09:57:24 +0200
commit7343c9f1bbc28be270b2093dcd9e713a7bdcdb89 (patch)
tree0ed9392291c50980c7dbff14c9a05edc601076de /ishtar_common/forms_common.py
parent10b603af68689ea3b251006b7ec05855b9616811 (diff)
downloadIshtar-7343c9f1bbc28be270b2093dcd9e713a7bdcdb89.tar.bz2
Ishtar-7343c9f1bbc28be270b2093dcd9e713a7bdcdb89.zip
Adapt forms, wizards, views, urls for new management of documents (refs #4107)
Diffstat (limited to 'ishtar_common/forms_common.py')
-rw-r--r--ishtar_common/forms_common.py58
1 files changed, 0 insertions, 58 deletions
diff --git a/ishtar_common/forms_common.py b/ishtar_common/forms_common.py
index 134e7ceb1..854fe2a71 100644
--- a/ishtar_common/forms_common.py
+++ b/ishtar_common/forms_common.py
@@ -1184,61 +1184,3 @@ AuthorFormset = formset_factory(AuthorFormSelection, can_delete=True,
AuthorFormset.form_label = _("Authors")
AuthorFormset.form_admin_name = _(u"Authors")
AuthorFormset.form_slug = "authors"
-
-
-class BaseImageForm(ManageOldType):
- form_label = _(u"Images")
- base_model = 'image'
- associated_models = {'licence': models.LicenseType,
- 'authors': models.Author}
-
- pk = forms.IntegerField(label=" ", widget=forms.HiddenInput,
- required=False)
- image = forms.ImageField(
- label=_(u"Image"), help_text=mark_safe(get_image_help()),
- max_length=255, required=False, widget=widgets.ImageFileInput())
- name = forms.CharField(label=_(u"Name"), max_length=250, required=False)
- authors = widgets.Select2MultipleField(
- model=models.Author, remote=True, label=_(u"Authors"),
- required=False, long_widget=True, new=True
- )
- description = forms.CharField(label=_(u"Description"), required=False,
- widget=forms.Textarea)
- creation_date = forms.DateField(
- label=_(u"Creation date"), required=False, widget=DatePicker)
- licence = widgets.Select2MultipleField(
- label=_(u"Licence"), required=False
- )
- reference = forms.CharField(label=_(u"Ref."), max_length=250,
- required=False)
- internal_reference = forms.CharField(label=_(u"Internal ref."),
- max_length=250, required=False)
- is_main = forms.BooleanField(label=_(u"Main image"), required=False,
- initial=False)
-
- TYPES = [
- FieldType('licence', models.LicenseType, True),
- ]
-
- def count_valid_fields(self, data):
- if not data:
- return 0
- return len(get_data_from_formset(data))
-
-
-class BaseImageFormset(FormSet):
- def clean(self):
- """
- Verify that no two images are main image
- """
- if any(self.errors):
- return
- have_main = False
- for form in self.forms:
- is_main = form.cleaned_data.get('is_main', False)
- if not is_main:
- continue
- if is_main and have_main:
- raise forms.ValidationError(_(u"Only one image can be a main "
- u"image"))
- have_main = True \ No newline at end of file