From 8d4d6e24cf8e81dd82e3d177e19344f3b385b773 Mon Sep 17 00:00:00 2001 From: Dylan Hillerbrand Date: Thu, 14 Nov 2024 15:03:17 -0500 Subject: [PATCH] fix(chant edit): fix feast/folio dropdowns; specify chant pk on POST request Fix behaviour of feast and folio dropdown selectors on Chant Edit page to show chants on a specific folio or for a specific feast so that the selector remains on the selected option. Fix blank headers for filtered lists of chants on Chant Edit page. Modify instructions on the Chant Edit page when no chant is selected (these has previously suggested that only full texts and volpiano was editable via that page; this has been corrected to note that all chant fields are editable). Modify SourceEditChantsView `get_object` method so that the edited chant is always set by pk rather than recency of creation. Previously, this had been effectively true when changes were made through the form, as Django parsed the URL parameter for chant pk into the request.GET queryset; however, since URL parameters cannot currently be set with the Django test client, tests of this views were relying on the recency of chant feature. Now tests and the live form rely on the same logic (the presence of a `pk` option in the form data itself). Reduce extraneous querysets in SourceEditChantsView. Refs: #1707, #1708 --- .../main_app/templates/chant_edit.html | 39 +++-- .../main_app/tests/test_views/test_chant.py | 5 +- .../cantusdb_project/main_app/views/chant.py | 156 ++++++------------ 3 files changed, 73 insertions(+), 127 deletions(-) diff --git a/django/cantusdb_project/main_app/templates/chant_edit.html b/django/cantusdb_project/main_app/templates/chant_edit.html index 373ae4d84..93b006111 100644 --- a/django/cantusdb_project/main_app/templates/chant_edit.html +++ b/django/cantusdb_project/main_app/templates/chant_edit.html @@ -43,14 +43,13 @@ {% endif %} - {% if pk_specified %} - {% if user.is_authenticated %} + {% if chant %}

View | Edit

- {% endif %}
{% csrf_token %} +
@@ -352,28 +351,28 @@
{% else %} -

Full text & Volpiano edit form

+

Chant Edit Form


-
-
1) Select a folio or a feast (in the right block)
-
2) Click "EDIT" next to any chant
-
3) The fulltext and Volpiano fields should appear in this area
-
4) Edit the fields according to the manuscript, following the fulltext guidelines created by Cantus
-
5) Click "SAVE"
-
-
+
    +
  1. Select a folio or a feast (in the right block).
  2. +
  3. Click "EDIT" next to any chant.
  4. +
  5. A form will appear in this area that allows you to edit the chant data.
  6. +
  7. Edit these fields according to the Cantus Database protocols.
  8. +
  9. Click "SAVE".
  10. +
+ -
+ -
+ {% endif %} @@ -385,13 +384,13 @@

Full text & Volpiano edit form

{{ source.short_heading }}

- {% if source.chant_set.exists %} + {% if source_has_chants %}