diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2020-06-02 13:18:25 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-02-28 12:15:21 +0100 |
commit | 9c589216b353924674b4d89b99053ad9f5cf1276 (patch) | |
tree | 22f26730c66de9d357f3ceb2f343d6d0cab53b91 /ishtar_common/forms_common.py | |
parent | 0984023102759aef68cf53c0ac7b9d15c050c3c4 (diff) | |
download | Ishtar-9c589216b353924674b4d89b99053ad9f5cf1276.tar.bz2 Ishtar-9c589216b353924674b4d89b99053ad9f5cf1276.zip |
Documents form: new fields
Diffstat (limited to 'ishtar_common/forms_common.py')
-rw-r--r-- | ishtar_common/forms_common.py | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/ishtar_common/forms_common.py b/ishtar_common/forms_common.py index 70204fbd7..20cf0b613 100644 --- a/ishtar_common/forms_common.py +++ b/ishtar_common/forms_common.py @@ -1237,6 +1237,7 @@ class DocumentForm(forms.ModelForm, CustomForm, ManageOldType): extra_form_modals = ["author", "person", "organization"] associated_models = {'source_type': models.SourceType, 'support_type': models.SupportType, + 'publisher': models.Organization, 'format_type': models.Format} pk = forms.IntegerField(label="", required=False, widget=forms.HiddenInput) @@ -1261,6 +1262,38 @@ class DocumentForm(forms.ModelForm, CustomForm, ManageOldType): authors = widgets.ModelJQueryAutocompleteField( model=models.Author, multiple=True, label=_("Authors"), new=True, long_widget=True, required=False) + publisher = forms.IntegerField( + label=_("Publisher"), + widget=widgets.JQueryAutoComplete( + reverse_lazy( + 'autocomplete-organization', + args=[models.organization_type_pks_lazy( + settings.ISHTAR_SLUGS["document-editor"])]), + limit={ + 'organization_type': models.organization_type_pks_lazy( + ['responsible_planning_service']) + }, + tips=models.get_publisher_label, + associated_model=models.Organization, new=True), + validators=[models.valid_id(models.Organization)], required=False) + license = widgets.Select2MultipleField( + label=_("Licences"), required=False) + tag = widgets.Select2MultipleField(label=_("Tags"), required=False) + language = widgets.ModelChoiceField( + model=models.Language, label=_("Language"), choices=[], + required=False) + issn = forms.CharField( + label=_("ISSN"), + validators=[validators.MaxLengthValidator(8)], required=False) + isbn = forms.CharField( + label=_("ISBN"), + validators=[validators.MaxLengthValidator(13)], required=False) + source = widgets.ModelJQueryAutocompleteField( + label=_("Source"), + model=models.Document, required=False) + source_free_input = forms.CharField( + label=_("Source free input"), + validators=[validators.MaxLengthValidator(500)], required=False) associated_url = forms.URLField( max_length=1000, required=False, label=_("Numerical ressource (web address)")) @@ -1301,6 +1334,9 @@ class DocumentForm(forms.ModelForm, CustomForm, ManageOldType): FieldType('source_type', models.SourceType), FieldType('support_type', models.SupportType), FieldType('format_type', models.Format), + FieldType('language', models.Language), + FieldType('licence', models.LicenseType, is_multiple=True), + FieldType('tag', models.DocumentTag, is_multiple=True), ] class Meta: @@ -1308,10 +1344,12 @@ class DocumentForm(forms.ModelForm, CustomForm, ManageOldType): fields = [ 'title', 'source_type', 'reference', 'internal_reference', 'format_type', 'support_type', 'scale', - 'image', 'associated_file', 'associated_url', + 'image', 'associated_file', 'associated_url', 'tag', 'authors', 'receipt_date', 'receipt_date_in_documentation', 'creation_date', + 'publisher', 'language', 'isbn', 'issn', 'license', 'container', "container_ref", + 'source', 'source_free_input', 'comment', 'description', 'additional_information', 'duplicate' ] @@ -1321,6 +1359,7 @@ class DocumentForm(forms.ModelForm, CustomForm, ManageOldType): 'image': FormHeader(_("Content")), 'authors': FormHeader(_("Authors")), 'receipt_date': FormHeader(_("Dates")), + 'publisher': FormHeader(_("Publishing"), collapse=True), 'container': FormHeader(_("Container"), collapse=True), 'comment': FormHeader(_("Advanced"), collapse=True), 'finds': FormHeader(_("Related items")), |