diff options
Diffstat (limited to 'chimere/forms.py')
| -rw-r--r-- | chimere/forms.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/chimere/forms.py b/chimere/forms.py index adf8687..301677b 100644 --- a/chimere/forms.py +++ b/chimere/forms.py @@ -412,7 +412,7 @@ class MarkerAdminFormBase(forms.ModelForm): raise forms.ValidationError(msg) categories = self.cleaned_data.get('categories', []) for pm in self.pms: - if not pm.mandatory or self.cleaned_data[pm.getNamedId()]: + if not pm.mandatory or self.cleaned_data.get(pm.getNamedId(), None): continue pm_cats = pm.subcategories.all() if not pm_cats or \ @@ -705,12 +705,15 @@ class MultimediaFileForm(BaseFileForm): """ Form for a multimedia file """ + name = forms.CharField(label=_("Name"), required=True, max_length=150, + initial="-") _related_name = 'multimedia_files' class Meta: model = MultimediaFile exclude = ('order', 'miniature', 'multimedia_type') + MultimediaFileFormSet = formset_factory(MultimediaFileForm, can_delete=True) @@ -730,6 +733,8 @@ class PictureFileForm(BaseFileForm): """ Form for a picture file """ + name = forms.CharField(label=_("Name"), required=True, max_length=150, + initial="-") _related_name = 'pictures' class Meta: @@ -737,6 +742,7 @@ class PictureFileForm(BaseFileForm): exclude = ('order', 'height', 'width', 'thumbnailfile', 'thumbnailfile_height', 'thumbnailfile_width', 'miniature') + PictureFileFormSet = formset_factory(PictureFileForm, can_delete=True) |
