Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge develop into staging; 16 July 2024 #1565

Merged
merged 71 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
6e26435
Fixed: Adjust base template
ahankinson Jun 17, 2024
01a1dea
Fixed: Move titles and scripts to their own block
ahankinson Jun 17, 2024
d4a58e1
New: mark institutions as private collectors
ahankinson Jun 17, 2024
b47f9c4
New: Add shelfmark to sources
ahankinson Jun 17, 2024
a5b3bb2
New: Migration script
ahankinson Jun 17, 2024
113e3ef
New: Holding institution autocomplete
ahankinson Jun 17, 2024
a0fe49b
Fixed: Remove transitive import for LoginView
ahankinson Jun 17, 2024
067f72d
Fixed: Optimize user source lookups
ahankinson Jun 17, 2024
38cd053
The Great Feast Rework
ahankinson Jun 18, 2024
9db92f4
Rework Source Display
ahankinson Jun 18, 2024
ee785b3
New: Add a split string helper tag
ahankinson Jun 18, 2024
73d5df4
Add migrations
ahankinson Jun 18, 2024
1168e29
Change source title and siglum to optional
ahankinson Jun 18, 2024
8fa654d
Fixed: Remove siglum column
ahankinson Jun 18, 2024
8bfc344
Tests: Disable Feast Detail Tests
ahankinson Jun 19, 2024
c41b458
Fixed: Small style update
ahankinson Jun 19, 2024
f507cb5
Fixed: Wrong order of columns
ahankinson Jun 19, 2024
c5bd3f5
Fixed: Update source display in full inventory
ahankinson Jun 19, 2024
9f5203a
WIP: Updates to the tests
ahankinson Jun 19, 2024
85ba222
Merge branch 'develop' into mega-changes-source-rework
ahankinson Jun 19, 2024
0100edb
Update display of source info
ahankinson Jun 19, 2024
0fd2c43
Merge branch 'develop' into mega-changes-source-rework
ahankinson Jun 19, 2024
faa90ed
Fixed: Re-sync templates
ahankinson Jun 19, 2024
20ad63e
Fixed: A bug in how the chants were counted
ahankinson Jun 20, 2024
f6c0208
New: Add a list of sources attached to the institution
ahankinson Jun 20, 2024
92d1908
New: Private Collector Institutinos
ahankinson Jun 20, 2024
7ddd9d8
Fixed: Make sorting of notation page obvious
ahankinson Jun 20, 2024
5067266
Adjust sorting field for sources in sequences
ahankinson Jun 20, 2024
1086b2e
Update the migration script
ahankinson Jun 20, 2024
66d9363
Fixed: source list on the browse_chants field
ahankinson Jun 20, 2024
5dd9620
Fixed: Refactor chant view
ahankinson Jun 21, 2024
498f4f3
Clean up JavaScript
ahankinson Jun 21, 2024
621c6d1
New: Add input filter for admin pages
ahankinson Jun 21, 2024
f3142cb
Adjust source admin page
ahankinson Jun 21, 2024
d4a1bc7
Adjust Institution admin page
ahankinson Jun 21, 2024
3377657
Add new migration script
ahankinson Jun 21, 2024
70a2655
Add City to Institution record string representation
ahankinson Jun 21, 2024
8358c0d
Add "Private" if source is Private
ahankinson Jun 21, 2024
f6851e7
Fixed: Problematic block name
ahankinson Jun 21, 2024
80cd509
Minor fixes to ci_search page
ahankinson Jun 21, 2024
223510a
Fixes for displaying source headings
ahankinson Jun 21, 2024
8db8c6d
Use bootstrap classes in the global search bar
ahankinson Jun 21, 2024
bb318d6
Fixed: Ordering of chants by siglum
ahankinson Jun 21, 2024
bd84f82
Fixed: Adjust APIs for new source structure
ahankinson Jun 21, 2024
9335b85
Style: Order imports
ahankinson Jun 21, 2024
b05de97
Working tests
ahankinson Jun 21, 2024
07fc91a
Fixed: Chants
ahankinson Jun 21, 2024
058ac85
Re-order imports
ahankinson Jun 21, 2024
2ae4966
Fixed: headings as properties
ahankinson Jun 21, 2024
fc8bb43
Formatting in migration script
ahankinson Jun 21, 2024
b7398dc
Update old migration script
ahankinson Jun 21, 2024
699c10e
Fixed: Update source search
ahankinson Jun 21, 2024
5f85304
Fixed: rework feast detail tests
ahankinson Jun 21, 2024
4d4e4a9
fix(templates): Change links under Resources menu and add link to pro…
dchiller Jul 10, 2024
d7522a1
Merge pull request #1557 from dchiller/i1556-change-resources-links
dchiller Jul 10, 2024
2dd7148
Merge branch 'develop' into mega-changes-source-rework
ahankinson Jul 13, 2024
f9ee743
Add merged migrations
dchiller Jul 14, 2024
b9c5d77
Format imports in urls.py
dchiller Jul 15, 2024
89f68d7
fix(chant create): escape special characters in suggested chant data
lucasmarchd01 Jul 15, 2024
2e3c429
Remove commented template code
ahankinson Jul 16, 2024
a174634
Fixed: String representation of Sources
ahankinson Jul 16, 2024
f0c6fa2
Fixed: Use holding institution siglum
ahankinson Jul 16, 2024
694e376
Fixed: Unnecessary select_related items
ahankinson Jul 16, 2024
adc2d1c
Merge pull request #1561 from lucasmarchd01/issue-1554
lucasmarchd01 Jul 16, 2024
6fd9d8c
feat(management): add command to reassign feast data and update chants
lucasmarchd01 Jul 16, 2024
8c24c2e
style(feast): remove comment
lucasmarchd01 Jul 16, 2024
68321f9
style(management): add comment
lucasmarchd01 Jul 16, 2024
ca66179
fix(management): reassign sequences
lucasmarchd01 Jul 16, 2024
ecf901c
Merge pull request #1545 from DDMAL/mega-changes-source-rework
dchiller Jul 16, 2024
f62481c
refactor(command): change feast mapping to a global variable
lucasmarchd01 Jul 17, 2024
a1ec9f7
Merge pull request #1564 from lucasmarchd01/issue-1560
lucasmarchd01 Jul 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions django/cantusdb_project/cantusindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
Cantus Index's (CI's) various APIs.
"""

import requests
from typing import Optional, Union, Callable
from main_app.models import Genre
import json
from typing import Optional, Union, Callable

import requests
from requests.exceptions import SSLError, Timeout, HTTPError

from main_app.models import Genre

CANTUS_INDEX_DOMAIN: str = "https://cantusindex.uwaterloo.ca"
OLD_CANTUS_INDEX_DOMAIN: str = "https://cantusindex.org"
DEFAULT_TIMEOUT: float = 2 # seconds
Expand Down
17 changes: 17 additions & 0 deletions django/cantusdb_project/main_app/admin/filters.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from django.contrib.admin import SimpleListFilter


class InputFilter(SimpleListFilter):
template = "admin/input_filter.html"

def lookups(self, request, model_admin):
return (),

def choices(self, changelist):
all_choice = next(super().choices(changelist))
all_choice["query_parts"] = (
(key, value)
for key, value in changelist.get_filters_params().items()
if key != self.parameter_name
)
yield all_choice
28 changes: 24 additions & 4 deletions django/cantusdb_project/main_app/admin/institution.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
from django.contrib import admin
from django.urls import reverse
from django.utils.safestring import mark_safe

from main_app.admin.base_admin import BaseModelAdmin
from main_app.models import Institution, InstitutionIdentifier
from main_app.models import Institution, InstitutionIdentifier, Source


class InstitutionSourceInline(admin.TabularInline):
model = Source
extra = 0
fields = ("link_id_field", "shelfmark", "published")
readonly_fields = ("link_id_field", "published", "shelfmark")
can_delete = False

def link_id_field(self, obj):
change_url = reverse('admin:main_app_source_change', args=(obj.pk,))
return mark_safe(f'<a href="{change_url}">{obj.pk}</a>')


class InstitutionIdentifierInline(admin.TabularInline):
Expand All @@ -12,10 +26,16 @@ class InstitutionIdentifierInline(admin.TabularInline):

@admin.register(Institution)
class InstitutionAdmin(BaseModelAdmin):
list_display = ("name", "siglum", "get_city_region", "country")
list_display = ("name", "siglum", "get_city_region", "country", "is_private_collector")
search_fields = ("name", "siglum", "city", "region", "alternate_names")
list_filter = ("city",)
inlines = (InstitutionIdentifierInline,)
list_filter = ("is_private_collector", "city")
inlines = (InstitutionIdentifierInline, InstitutionSourceInline)
fieldsets = [
(None, {"fields": ("name", "city", "region", "country", "alternate_names",
"former_sigla", "private_notes")}),
("Private Collector", {"fields": ["is_private_collector"]}),
("Holding Institution", {"fields": ["siglum"]})
]

def get_city_region(self, obj) -> str:
city: str = obj.city if obj.city else "[No city]"
Expand Down
27 changes: 25 additions & 2 deletions django/cantusdb_project/main_app/admin/source.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,34 @@
from django.contrib import admin

from main_app.admin.base_admin import BaseModelAdmin, EXCLUDE, READ_ONLY
from main_app.admin.filters import InputFilter
from main_app.forms import AdminSourceForm
from main_app.models import Source


class SourceKeyFilter(InputFilter):
parameter_name = "holding_institution__siglum"
title = "Institution Siglum"

def queryset(self, request, queryset):
if self.value():
return queryset.filter(holding_institution__siglum__icontains=self.value())


@admin.register(Source)
class SourceAdmin(BaseModelAdmin):
exclude = EXCLUDE + ("source_status",)
raw_id_fields = ("holding_institution",)

# These search fields are also available on the user-source inline relationship in the user admin page
search_fields = (
"siglum",
"title",
"shelfmark",
"holding_institution__siglum",
"holding_institution__name",
"id",
"provenance_notes"
)
readonly_fields = READ_ONLY + (
"number_of_chants",
Expand All @@ -36,19 +51,27 @@ class SourceAdmin(BaseModelAdmin):
)

list_display = (
"title",
"siglum",
"shelfmark",
# "title",
"holding_institution",
# "siglum",
"id",
)

list_filter = (
SourceKeyFilter,
"full_source",
"segment",
"source_status",
"published",
"century",
"holding_institution__is_private_collector",
)

ordering = ("siglum",)

form = AdminSourceForm

def get_queryset(self, request):
queryset = super().get_queryset(request)
return queryset.select_related("holding_institution")
22 changes: 14 additions & 8 deletions django/cantusdb_project/main_app/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,10 @@ class SourceCreateForm(forms.ModelForm):
class Meta:
model = Source
fields = [
"title",
"siglum",
# "title",
# "siglum",
"holding_institution",
"shelfmark",
"provenance",
"provenance_notes",
"full_source",
Expand All @@ -196,8 +198,10 @@ class Meta:
"indexing_notes",
]
widgets = {
"title": TextInputWidget(),
"siglum": TextInputWidget(),
# "title": TextInputWidget(),
# "siglum": TextInputWidget(),
"holding_institution": autocomplete.ModelSelect2(url="holding-autocomplete"),
"shelfmark": TextInputWidget(),
"provenance": autocomplete.ModelSelect2(url="provenance-autocomplete"),
"provenance_notes": TextInputWidget(),
"date": TextInputWidget(),
Expand Down Expand Up @@ -355,8 +359,10 @@ class SourceEditForm(forms.ModelForm):
class Meta:
model = Source
fields = [
"title",
"siglum",
# "title",
# "siglum",
"holding_institution",
"shelfmark",
"provenance",
"provenance_notes",
"full_source",
Expand All @@ -380,8 +386,8 @@ class Meta:
"other_editors",
]
widgets = {
"title": TextInputWidget(),
"siglum": TextInputWidget(),
"holding_institution": autocomplete.ModelSelect2(url="holding-autocomplete"),
"shelfmark": TextInputWidget(),
"provenance": autocomplete.ModelSelect2(url="provenance-autocomplete"),
"provenance_notes": TextInputWidget(),
"date": TextInputWidget(),
Expand Down
Loading
Loading