From bd22850065454cc001f74998cb945d946aab83ae Mon Sep 17 00:00:00 2001 From: Andrew Hankinson Date: Thu, 13 Jun 2024 13:40:26 +0200 Subject: [PATCH] Fixed: Remove the RISM Sigla table This removes the RISM Sigla table and all the places where it is referenced in the code. I have saved a local backup of the data in CSV before exporting. Running the migration will delete the table and all the data in the database. Fixes #1508 # Conflicts: # django/cantusdb_project/main_app/models/source.py --- .../main_app/admin/__init__.py | 1 - .../main_app/admin/rism_siglum.py | 11 ----- django/cantusdb_project/main_app/forms.py | 18 -------- ...ve_source_rism_siglum_delete_rismsiglum.py | 20 ++++++++ .../main_app/models/__init__.py | 1 - .../main_app/models/rism_siglum.py | 22 --------- .../main_app/models/source.py | 7 --- .../main_app/templates/content_overview.html | 2 +- .../main_app/templates/source_create.html | 11 ----- .../main_app/templates/source_edit.html | 13 ------ .../main_app/tests/make_fakes.py | 14 ------ .../main_app/tests/test_views.py | 46 +------------------ django/cantusdb_project/main_app/urls.py | 6 --- .../cantusdb_project/main_app/views/source.py | 16 ++----- .../cantusdb_project/main_app/views/views.py | 12 ----- 15 files changed, 28 insertions(+), 172 deletions(-) delete mode 100644 django/cantusdb_project/main_app/admin/rism_siglum.py create mode 100644 django/cantusdb_project/main_app/migrations/0019_remove_source_rism_siglum_delete_rismsiglum.py delete mode 100644 django/cantusdb_project/main_app/models/rism_siglum.py diff --git a/django/cantusdb_project/main_app/admin/__init__.py b/django/cantusdb_project/main_app/admin/__init__.py index 6839ad2d8..994faadaa 100644 --- a/django/cantusdb_project/main_app/admin/__init__.py +++ b/django/cantusdb_project/main_app/admin/__init__.py @@ -6,7 +6,6 @@ from main_app.admin.notation import NotationAdmin from main_app.admin.office import OfficeAdmin from main_app.admin.provenance import ProvenanceAdmin -from main_app.admin.rism_siglum import RismSiglumAdmin from main_app.admin.segment import SegmentAdmin from main_app.admin.sequence import SequenceAdmin from main_app.admin.source import SourceAdmin diff --git a/django/cantusdb_project/main_app/admin/rism_siglum.py b/django/cantusdb_project/main_app/admin/rism_siglum.py deleted file mode 100644 index 36113bec8..000000000 --- a/django/cantusdb_project/main_app/admin/rism_siglum.py +++ /dev/null @@ -1,11 +0,0 @@ -from django.contrib import admin - -from main_app.admin.base_admin import BaseModelAdmin -from main_app.forms import AdminRismSiglumForm -from main_app.models import RismSiglum - - -@admin.register(RismSiglum) -class RismSiglumAdmin(BaseModelAdmin): - search_fields = ("name",) - form = AdminRismSiglumForm diff --git a/django/cantusdb_project/main_app/forms.py b/django/cantusdb_project/main_app/forms.py index 41abb97b3..4b7222c7a 100644 --- a/django/cantusdb_project/main_app/forms.py +++ b/django/cantusdb_project/main_app/forms.py @@ -7,7 +7,6 @@ Notation, Feast, Source, - RismSiglum, Segment, Provenance, Century, @@ -176,7 +175,6 @@ class Meta: model = Source fields = [ "title", - "rism_siglum", "siglum", "provenance", "provenance_notes", @@ -213,7 +211,6 @@ class Meta: "fragmentarium_id": TextInputWidget(), "dact_id": TextInputWidget(), "indexing_notes": TextAreaWidget(), - "rism_siglum": autocomplete.ModelSelect2(url="rismsiglum-autocomplete"), "current_editors": autocomplete.ModelSelect2Multiple( url="current-editors-autocomplete" ), @@ -365,7 +362,6 @@ class Meta: model = Source fields = [ "title", - "rism_siglum", "siglum", "provenance", "provenance_notes", @@ -391,7 +387,6 @@ class Meta: ] widgets = { "title": TextInputWidget(), - "rism_siglum": autocomplete.ModelSelect2(url="rismsiglum-autocomplete"), "siglum": TextInputWidget(), "provenance": autocomplete.ModelSelect2(url="provenance-autocomplete"), "provenance_notes": TextInputWidget(), @@ -634,14 +629,6 @@ class Meta: name = forms.CharField(required=True, widget=TextInputWidget) -class AdminRismSiglumForm(forms.ModelForm): - class Meta: - model = RismSiglum - fields = "__all__" - - name = forms.CharField(required=True, widget=TextInputWidget) - - class AdminSegmentForm(forms.ModelForm): class Meta: model = Segment @@ -704,11 +691,6 @@ class Meta: help_text="RISM-style siglum + Shelf-mark (e.g. GB-Ob 202).", ) - rism_siglum = forms.ModelChoiceField( - queryset=RismSiglum.objects.all().order_by("name"), - required=False, - ) - provenance = forms.ModelChoiceField( queryset=Provenance.objects.all().order_by("name"), required=False, diff --git a/django/cantusdb_project/main_app/migrations/0019_remove_source_rism_siglum_delete_rismsiglum.py b/django/cantusdb_project/main_app/migrations/0019_remove_source_rism_siglum_delete_rismsiglum.py new file mode 100644 index 000000000..02763726b --- /dev/null +++ b/django/cantusdb_project/main_app/migrations/0019_remove_source_rism_siglum_delete_rismsiglum.py @@ -0,0 +1,20 @@ +# Generated by Django 4.2.11 on 2024-06-13 11:43 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("main_app", "0018_institution_former_sigla"), + ] + + operations = [ + migrations.RemoveField( + model_name="source", + name="rism_siglum", + ), + migrations.DeleteModel( + name="RismSiglum", + ), + ] diff --git a/django/cantusdb_project/main_app/models/__init__.py b/django/cantusdb_project/main_app/models/__init__.py index 9959354e9..35e764e0c 100644 --- a/django/cantusdb_project/main_app/models/__init__.py +++ b/django/cantusdb_project/main_app/models/__init__.py @@ -9,7 +9,6 @@ from main_app.models.provenance import Provenance from main_app.models.segment import Segment from main_app.models.sequence import Sequence -from main_app.models.rism_siglum import RismSiglum from main_app.models.source import Source from main_app.models.institution import Institution from main_app.models.institution_identifier import InstitutionIdentifier diff --git a/django/cantusdb_project/main_app/models/rism_siglum.py b/django/cantusdb_project/main_app/models/rism_siglum.py deleted file mode 100644 index ecfa4339f..000000000 --- a/django/cantusdb_project/main_app/models/rism_siglum.py +++ /dev/null @@ -1,22 +0,0 @@ -from django.db import models -from main_app.models import BaseModel - - -class RismSiglum(BaseModel): - """The `RismSiglum` model, a foreign key to the `Source` model - - The `name` attribute takes the form of Country code, a dash, an indicator of a city in uppercase, - and an indicator of an institution in lower-case. - - Example: GB-Lbl stands for Great Britain, London, British Library - """ - - name = models.CharField(max_length=255) - description = models.TextField(null=True, blank=True) - - class Meta: - verbose_name = "RISM siglum" - verbose_name_plural = "RISM sigla" - - def __str__(self): - return self.name diff --git a/django/cantusdb_project/main_app/models/source.py b/django/cantusdb_project/main_app/models/source.py index e49363306..30abb038f 100644 --- a/django/cantusdb_project/main_app/models/source.py +++ b/django/cantusdb_project/main_app/models/source.py @@ -37,13 +37,6 @@ class Source(BaseModel): blank=False, help_text="RISM-style siglum + Shelf-mark (e.g. GB-Ob 202).", ) - # the RISM siglum uniquely identifies a library or holding institution - rism_siglum = models.ForeignKey( - "RismSiglum", - on_delete=models.PROTECT, - null=True, - blank=True, - ) holding_institution = models.ForeignKey( "Institution", on_delete=models.PROTECT, diff --git a/django/cantusdb_project/main_app/templates/content_overview.html b/django/cantusdb_project/main_app/templates/content_overview.html index ca8b01532..1d4ec3c86 100644 --- a/django/cantusdb_project/main_app/templates/content_overview.html +++ b/django/cantusdb_project/main_app/templates/content_overview.html @@ -47,7 +47,7 @@

Content Overview

{% elif object.name %} - {% if object|classname == "Notation" or object|classname == "Segment" or object|classname == "RismSiglum" %} + {% if object|classname == "Notation" or object|classname == "Segment" %} {{ object.name|truncatechars:30 }} {% else %} {{ object.name|truncatechars:30 }} diff --git a/django/cantusdb_project/main_app/templates/source_create.html b/django/cantusdb_project/main_app/templates/source_create.html index beaf67dd1..29f569092 100644 --- a/django/cantusdb_project/main_app/templates/source_create.html +++ b/django/cantusdb_project/main_app/templates/source_create.html @@ -44,17 +44,6 @@

Create Source

{{ form.title }} - -
- -
{{ form.rism_siglum }} - - Browse RISM sigla - (opens in new tab) - -
diff --git a/django/cantusdb_project/main_app/templates/source_edit.html b/django/cantusdb_project/main_app/templates/source_edit.html index b4f6fe23f..e7dcaa476 100644 --- a/django/cantusdb_project/main_app/templates/source_edit.html +++ b/django/cantusdb_project/main_app/templates/source_edit.html @@ -43,19 +43,6 @@

Edit Source {{ source.title }}

-
-
- - {{ form.rism_siglum }} - - Browse RISM sigla - (opens in new tab) - -
-
-