From 95157460cbb8559b0fa4a8f26e1411b63a898dcc Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Wed, 5 Jul 2017 04:39:54 -0400 Subject: [PATCH] Add new UI method to switch between required metadata and optional metadata without incurring in metadata value loss. Add modifying relationship of document type and metadata type from the document type and from the metadata type views. Closes GitLab issues #337 #373. Signed-off-by: Roberto Rosario --- docs/releases/2.5.rst | 11 +- .../appearance/generic_form_instance.html | 13 +- mayan/apps/metadata/apps.py | 9 +- mayan/apps/metadata/forms.py | 67 ++++++++++ mayan/apps/metadata/links.py | 16 ++- .../migrations/0007_auto_20150918_0800.py | 19 ++- mayan/apps/metadata/urls.py | 17 ++- mayan/apps/metadata/views.py | 123 ++++++++++++------ 8 files changed, 206 insertions(+), 69 deletions(-) diff --git a/docs/releases/2.5.rst b/docs/releases/2.5.rst index 4d93c6f09e..0084d7e73e 100644 --- a/docs/releases/2.5.rst +++ b/docs/releases/2.5.rst @@ -44,7 +44,14 @@ Other Changes its own separate $HOME directory. Additionally give every libreoffice its own UserInstallation file in the $HOME directory. Works around Libre Office issue: https://bugs.documentfoundation.org/show_bug.cgi?id=37531 - Solves or affects GitLab issues #393 #258 #198 #175 + Solves or affects GitLab issues #393 #258 #198 #175 +- Document type-metadata type relationship. Add new UI method to switch between + required metadata and optional metadata for a document type. This new + method does not forces users to remove a metadata type before making the + switch and thus avoid deletion of existing metadata entries. GitLab issue #337. +- It is now possible to change the relationship between metadata types and + document types from either the metadata type list or document type list. + GitLab issue #373. Removals @@ -103,5 +110,7 @@ Bugs fixed or issues closed * `GitHub issue #255 `_ Uploading a local file via api * `GitLab issue #215 `_ Download text contents * `GitLab issue #286 `_ User configurable mailer +* `GitLab issue #337 `_ Better way to switch Optional to Required Metadata +* `GitLab issue #373 `_ (feature request) Allow selecting document types for metadata .. _PyPI: https://pypi.python.org/pypi/mayan-edms/ diff --git a/mayan/apps/appearance/templates/appearance/generic_form_instance.html b/mayan/apps/appearance/templates/appearance/generic_form_instance.html index a65b594acd..ca3b586a82 100644 --- a/mayan/apps/appearance/templates/appearance/generic_form_instance.html +++ b/mayan/apps/appearance/templates/appearance/generic_form_instance.html @@ -22,7 +22,17 @@ {% for field in form.visible_fields %} {% if field.errors %}
{% endif %} - {% render_field field class+="form-control" %} + {% if field|widget_type == 'radioselect' %} +
+ {% for option in field %} + + {% endfor %} +
+ {% else %} + {% render_field field class+="form-control" %} + {% endif %} {% if field.errors %}
{% endif %} {% endfor %} @@ -38,7 +48,6 @@ {% if field|widget_type != 'checkboxinput' and not field.field.widget.attrs.hidden %} {% if not hide_labels %}{{ field.label_tag }}{% if field.field.required and not read_only %} ({% trans 'required' %}){% endif %}{% endif %} {% endif %} - {% if field|widget_type == 'checkboxinput' %}