Skip to content

Commit

Permalink
Merge pull request #1061 from DDMAL/staging
Browse files Browse the repository at this point in the history
Merge Staging into Production, 2023-Sep-21 edition
  • Loading branch information
jacobdgm committed Sep 26, 2023
2 parents 75ea8b1 + a9e337f commit 6730be1
Show file tree
Hide file tree
Showing 16 changed files with 271 additions and 643 deletions.
2 changes: 1 addition & 1 deletion cron/cron.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
20 4 1 * * bash /home/ubuntu/code/CantusDB/cron/postgres/monthly.sh
30 4 1 1 * bash /home/ubuntu/code/CantusDB/cron/postgres/yearly.sh
40 4 1 * * bash /home/ubuntu/code/CantusDB/cron/management/manage.sh populate_next_chant_fields; bash /home/ubuntu/code/CantusDB/cron/management/manage.sh populate_is_last_chant_in_feast
50 4 * * 0 /usr/local/bin/docker-compose run --rm certbot certonly --webroot --webroot-path /var/www/certbot/ -d cantusdatabase.org --renew-hook "nginx -s reload"
50 4 * * 0 /usr/local/bin/docker-compose run --rm certbot certonly --webroot --webroot-path /var/www/certbot/ -d cantusdatabase.org -d www.cantusdatabase.org --renew-hook "nginx -s reload"
14 changes: 14 additions & 0 deletions django/cantusdb_project/main_app/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ def get_source_siglum(self, obj):
"cantus_id",
"id",
)

readonly_fields = (
"date_created",
"date_updated",
)

list_filter = (
"genre",
"office",
Expand All @@ -70,6 +76,8 @@ def get_source_siglum(self, obj):
"is_last_chant_in_feast",
"visible_status",
"date",
"volpiano_notes",
"volpiano_intervals",
)
form = AdminChantForm
raw_id_fields = (
Expand Down Expand Up @@ -161,6 +169,12 @@ class SourceAdmin(BaseModelAdmin):
"title",
"id",
)
readonly_fields = (
"number_of_chants",
"number_of_melodies",
"date_created",
"date_updated",
)
# from the Django docs:
# Adding a ManyToManyField to this list will instead use a nifty unobtrusive JavaScript “filter” interface
# that allows searching within the options. The unselected and selected options appear in two boxes side by side.
Expand Down
161 changes: 28 additions & 133 deletions django/cantusdb_project/main_app/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
VolpianoAreaWidget,
SelectWidget,
CheckboxWidget,
AdminTextAreaWidget,
AdminTextInputWidget,
)
from django.contrib.auth import get_user_model
from django.db.models import Q
Expand Down Expand Up @@ -290,6 +288,11 @@ class Meta:
"image_link",
"indexing_notes",
"addendum",
"chant_range",
"manuscript_full_text_std_proofread",
"manuscript_full_text_proofread",
"volpiano_proofread",
"proofread_by",
]
widgets = {
# manuscript_full_text_std_spelling: defined below (required)
Expand All @@ -312,107 +315,13 @@ class Meta:
"image_link": TextInputWidget(),
"indexing_notes": TextAreaWidget(),
"addendum": TextInputWidget(),
}

manuscript_full_text_std_spelling = forms.CharField(
required=True,
widget=TextAreaWidget,
help_text="Manuscript full text with standardized spelling. Enter the words "
"according to the manuscript but normalize their spellings following "
"Classical Latin forms. Use upper-case letters for proper nouns, "
'the first word of each chant, and the first word after "Alleluia" for '
"Mass Alleluias. Punctuation is omitted.",
)

folio = forms.CharField(
required=True,
widget=TextInputWidget,
help_text="Binding order",
)

c_sequence = forms.CharField(
required=True,
widget=TextInputWidget,
help_text="Each folio starts with '1'.",
)

# We use NameModelChoiceField here so the dropdown list of office/mass displays the name
# instead of [name] + description
office = NameModelChoiceField(
queryset=Office.objects.all().order_by("name"),
required=False,
)
office.widget.attrs.update({"class": "form-control custom-select custom-select-sm"})

# We use NameModelChoiceField here so the dropdown list of genres displays the name
# instead of [name] + description
genre = NameModelChoiceField(
queryset=Genre.objects.all().order_by("name"),
required=False,
)
genre.widget.attrs.update({"class": "form-control custom-select custom-select-sm"})


class ChantProofreadForm(forms.ModelForm):
class Meta:
model = Chant
fields = [
"manuscript_full_text_std_spelling",
"manuscript_full_text",
"volpiano",
"marginalia",
"folio",
"c_sequence",
"feast",
"office",
"genre",
"position",
"cantus_id",
"melody_id",
"mode",
"finalis",
"differentia",
"extra",
"image_link",
"indexing_notes",
# additional fields for the proofreading form
"manuscript_full_text_std_proofread",
"manuscript_full_text_proofread",
"volpiano_proofread",
"proofread_by",
"manuscript_syllabized_full_text",
"chant_range",
"siglum",
"addendum",
"differentia_new",
]
widgets = {
# manuscript_full_text_std_spelling: defined below (required)
"manuscript_full_text": TextAreaWidget(),
"volpiano": VolpianoAreaWidget(),
"marginalia": TextInputWidget(),
# folio: defined below (required)
# c_sequence: defined below (required)
# "office": defined below (foreignkey)
# "genre": defined below (foreignkey)
"position": TextInputWidget(),
"cantus_id": TextInputWidget(),
"melody_id": TextInputWidget(),
"mode": TextInputWidget(),
"finalis": TextInputWidget(),
"differentia": TextInputWidget(),
"extra": TextInputWidget(),
"image_link": TextInputWidget(),
"indexing_notes": TextAreaWidget(),
# additional fields for the proofreading form
"chant_range": VolpianoAreaWidget(),
"manuscript_full_text_std_proofread": CheckboxWidget(),
"manuscript_full_text_proofread": CheckboxWidget(),
"volpiano_proofread": CheckboxWidget(),
"manuscript_syllabized_full_text": TextAreaWidget(),
"chant_range": VolpianoAreaWidget(),
"siglum": TextInputWidget(),
"addendum": TextInputWidget(),
"differentia_new": TextInputWidget(),
"proofread_by": autocomplete.ModelSelect2Multiple(
url="proofread-by-autocomplete"
),
}

manuscript_full_text_std_spelling = forms.CharField(
Expand All @@ -437,12 +346,6 @@ class Meta:
help_text="Each folio starts with '1'.",
)

feast = forms.ModelChoiceField(
queryset=Feast.objects.all().order_by("name"),
required=False,
)
feast.widget.attrs.update({"class": "form-control custom-select custom-select-sm"})

# We use NameModelChoiceField here so the dropdown list of office/mass displays the name
# instead of [name] + description
office = NameModelChoiceField(
Expand All @@ -454,19 +357,10 @@ class Meta:
# We use NameModelChoiceField here so the dropdown list of genres displays the name
# instead of [name] + description
genre = NameModelChoiceField(
queryset=Genre.objects.all().order_by("name"), required=False
)
genre.widget.attrs.update({"class": "form-control custom-select custom-select-sm"})

proofread_by = forms.ModelMultipleChoiceField(
queryset=get_user_model()
.objects.filter(Q(groups__name="project manager") | Q(groups__name="editor"))
.order_by("last_name"),
queryset=Genre.objects.all().order_by("name"),
required=False,
)
proofread_by.widget.attrs.update(
{"class": "form-control custom-select custom-select-sm"}
)
genre.widget.attrs.update({"class": "form-control custom-select custom-select-sm"})


class SourceEditForm(forms.ModelForm):
Expand Down Expand Up @@ -637,7 +531,7 @@ class Meta:
model = Century
fields = "__all__"

name = forms.CharField(required=True, widget=AdminTextInputWidget)
name = forms.CharField(required=True, widget=TextInputWidget)


class AdminChantForm(forms.ModelForm):
Expand All @@ -655,7 +549,7 @@ class Meta:

manuscript_full_text_std_spelling = forms.CharField(
required=True,
widget=AdminTextAreaWidget,
widget=TextAreaWidget,
help_text="Manuscript full text with standardized spelling. Enter the words "
"according to the manuscript but normalize their spellings following "
"Classical Latin forms. Use upper-case letters for proper nouns, "
Expand All @@ -665,13 +559,13 @@ class Meta:

folio = forms.CharField(
required=True,
widget=AdminTextInputWidget,
widget=TextInputWidget,
help_text="Binding order",
)

c_sequence = forms.CharField(
required=True,
widget=AdminTextInputWidget,
widget=TextInputWidget,
help_text="Each folio starts with '1'.",
label="Sequence",
)
Expand Down Expand Up @@ -702,24 +596,24 @@ class Meta:
model = Feast
fields = "__all__"

name = forms.CharField(required=True, widget=AdminTextInputWidget)
name = forms.CharField(required=True, widget=TextInputWidget)


class AdminGenreForm(forms.ModelForm):
class Meta:
model = Genre
fields = "__all__"

name = forms.CharField(required=True, widget=AdminTextInputWidget)
description = forms.CharField(required=True, widget=AdminTextAreaWidget)
name = forms.CharField(required=True, widget=TextInputWidget)
description = forms.CharField(required=True, widget=TextAreaWidget)


class AdminNotationForm(forms.ModelForm):
class Meta:
model = Notation
fields = "__all__"

name = forms.CharField(required=True, widget=AdminTextInputWidget)
name = forms.CharField(required=True, widget=TextInputWidget)
name.widget.attrs.update({"style": "width: 400px;"})


Expand All @@ -728,32 +622,32 @@ class Meta:
model = Office
fields = "__all__"

name = forms.CharField(required=True, widget=AdminTextInputWidget)
description = forms.CharField(required=True, widget=AdminTextAreaWidget)
name = forms.CharField(required=True, widget=TextInputWidget)
description = forms.CharField(required=True, widget=TextAreaWidget)


class AdminProvenanceForm(forms.ModelForm):
class Meta:
model = Provenance
fields = "__all__"

name = forms.CharField(required=True, widget=AdminTextInputWidget)
name = forms.CharField(required=True, widget=TextInputWidget)


class AdminRismSiglumForm(forms.ModelForm):
class Meta:
model = RismSiglum
fields = "__all__"

name = forms.CharField(required=True, widget=AdminTextInputWidget)
name = forms.CharField(required=True, widget=TextInputWidget)


class AdminSegmentForm(forms.ModelForm):
class Meta:
model = Segment
fields = "__all__"

name = forms.CharField(required=True, widget=AdminTextInputWidget)
name = forms.CharField(required=True, widget=TextInputWidget)
name.widget.attrs.update({"style": "width: 400px;"})


Expand Down Expand Up @@ -798,14 +692,14 @@ class Meta:

title = forms.CharField(
required=True,
widget=AdminTextInputWidget,
widget=TextInputWidget,
help_text="Full Manuscript Identification (City, Archive, Shelf-mark)",
)
title.widget.attrs.update({"style": "width: 610px;"})

siglum = forms.CharField(
required=True,
widget=AdminTextInputWidget,
widget=TextInputWidget,
help_text="RISM-style siglum + Shelf-mark (e.g. GB-Ob 202).",
)

Expand Down Expand Up @@ -838,6 +732,7 @@ class Meta:
| Q(groups__name="editor")
| Q(groups__name="contributor")
)
.distinct()
.order_by("full_name"),
required=False,
widget=FilteredSelectMultiple(verbose_name="current editors", is_stacked=False),
Expand Down Expand Up @@ -891,7 +786,7 @@ class Meta:

email = forms.CharField(
required=True,
widget=AdminTextInputWidget,
widget=TextInputWidget,
)
email.widget.attrs.update({"style": "width: 300px;"})

Expand Down

0 comments on commit 6730be1

Please sign in to comment.