Repository: DDMAL/CantusDB

Issue:
Remove ability to edit chant segment and segment-specific fields
We're currently in process of figuring out what to do with source and chant segments, so we should remove the ability for users to edit those and related fields (in other words, undo #1473) until we have that figured out.

EDIT: I'm just going to comment out (with a note) the relevant places in the Chant Edit and Chant Create forms -- I suspect we will shortly keep much of the functionality, but perhaps do some renaming. 


Discussion:

Resolving patch:
diff --git a/django/cantusdb_project/main_app/forms.py b/django/cantusdb_project/main_app/forms.py
--- a/django/cantusdb_project/main_app/forms.py
+++ b/django/cantusdb_project/main_app/forms.py
@@ -83,13 +83,14 @@ class Meta:
             "content_structure",
             "indexing_notes",
             "addendum",
-            "segment",
-            "liturgical_function",
-            "polyphony",
-            "cm_melody_id",
-            "incipit_of_refrain",
-            "later_addition",
-            "rubrics",
+            # See issue #1521: Temporarily commenting out segment-related functions on Chant
+            # "segment",
+            # "liturgical_function",
+            # "polyphony",
+            # "cm_melody_id",
+            # "incipit_of_refrain",
+            # "later_addition",
+            # "rubrics",
         ]
         # the widgets dictionary is ignored for a model field with a non-empty
         # choices attribute. In this case, you must override the form field to
@@ -148,13 +149,14 @@ class Meta:
         "Mass Alleluias. Punctuation is omitted.",
     )
 
-    segment = SelectWidgetNameModelChoiceField(
-        queryset=Segment.objects.all().order_by("id"),
-        required=True,
-        initial=Segment.objects.get(id=4063),  # Default to the "Cantus" segment
-        help_text="Select the Database segment that the chant belongs to. "
-        "In most cases, this will be the CANTUS segment.",
-    )
+    # See issue #1521: Temporarily commenting out segment-related functions on Chant
+    # segment = SelectWidgetNameModelChoiceField(
+    #     queryset=Segment.objects.all().order_by("id"),
+    #     required=True,
+    #     initial=Segment.objects.get(id=4063),  # Default to the "Cantus" segment
+    #     help_text="Select the Database segment that the chant belongs to. "
+    #     "In most cases, this will be the CANTUS segment.",
+    # )
 
     # automatically computed fields
     # source and incipit are mandatory fields in model,
@@ -281,13 +283,14 @@ class Meta:
             "manuscript_full_text_proofread",
             "volpiano_proofread",
             "proofread_by",
-            "segment",
-            "liturgical_function",
-            "polyphony",
-            "cm_melody_id",
-            "incipit_of_refrain",
-            "later_addition",
-            "rubrics",
+            # See issue #1521: Temporarily commenting out segment-related functions on Chant
+            # "segment",
+            # "liturgical_function",
+            # "polyphony",
+            # "cm_melody_id",
+            # "incipit_of_refrain",
+            # "later_addition",
+            # "rubrics",
         ]
         widgets = {
             # manuscript_full_text_std_spelling: defined below (required)
@@ -317,12 +320,13 @@ class Meta:
             "proofread_by": autocomplete.ModelSelect2Multiple(
                 url="proofread-by-autocomplete"
             ),
-            "polyphony": SelectWidget(),
-            "liturgical_function": SelectWidget(),
-            "cm_melody_id": TextInputWidget(),
-            "incipit_of_refrain": TextInputWidget(),
-            "later_addition": TextInputWidget(),
-            "rubrics": TextInputWidget(),
+            # See issue #1521: Temporarily commenting out segment-related functions on Chant
+            # "polyphony": SelectWidget(),
+            # "liturgical_function": SelectWidget(),
+            # "cm_melody_id": TextInputWidget(),
+            # "incipit_of_refrain": TextInputWidget(),
+            # "later_addition": TextInputWidget(),
+            # "rubrics": TextInputWidget(),
         }
 
     manuscript_full_text_std_spelling = forms.CharField(
@@ -347,12 +351,13 @@ class Meta:
         help_text="Each folio starts with '1'.",
     )
 
-    segment = SelectWidgetNameModelChoiceField(
-        queryset=Segment.objects.all().order_by("id"),
-        required=True,
-        help_text="Select the Database segment that the chant belongs to. "
-        "In most cases, this will be the CANTUS segment.",
-    )
+    # See issue #1521: Temporarily commenting out segment-related functions on Chant
+    # segment = SelectWidgetNameModelChoiceField(
+    #     queryset=Segment.objects.all().order_by("id"),
+    #     required=True,
+    #     help_text="Select the Database segment that the chant belongs to. "
+    #     "In most cases, this will be the CANTUS segment.",
+    # )
 
 
 class SourceEditForm(forms.ModelForm):


Test patch: