-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1622 from DDMAL/develop
- Loading branch information
Showing
43 changed files
with
7,029 additions
and
6,453 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,7 @@ jobs: | |
id: lychee | ||
uses: lycheeverse/[email protected] | ||
with: | ||
args: --exclude http:\/\/cantus\.sk.* ${{ matrix.links }} | ||
args: --exclude http:\/\/cantus\.sk.* --exclude https:\/\/us06web\.zoom\.us* ${{ matrix.links }} | ||
format: json | ||
output: /tmp/link-checker-output.txt | ||
- name: Curating Link Checker Output | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
django/cantusdb_project/main_app/migrations/0029_institution_migrated_identifier.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Generated by Django 4.2.14 on 2024-08-23 08:04 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("main_app", "0028_alter_institution_options_and_more"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="institution", | ||
name="migrated_identifier", | ||
field=models.CharField( | ||
blank=True, | ||
help_text="Former Cantus identifier. Should not be used for new records.", | ||
max_length=64, | ||
null=True, | ||
), | ||
), | ||
] |
21 changes: 21 additions & 0 deletions
21
django/cantusdb_project/main_app/migrations/0030_institution_is_private_collection.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Generated by Django 4.2.14 on 2024-08-23 08:21 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("main_app", "0029_institution_migrated_identifier"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="institution", | ||
name="is_private_collection", | ||
field=models.BooleanField( | ||
default=False, | ||
help_text="Mark this instititution as being a private collection. This is used to identify private \ncollectors regardless of whether they have a RISM siglum or not.\n", | ||
), | ||
), | ||
] |
32 changes: 32 additions & 0 deletions
32
...go/cantusdb_project/main_app/migrations/0031_alter_source_holding_institution_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Generated by Django 4.2.14 on 2024-08-30 13:58 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("main_app", "0030_institution_is_private_collection"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="source", | ||
name="holding_institution", | ||
field=models.ForeignKey( | ||
default=19, | ||
on_delete=django.db.models.deletion.PROTECT, | ||
to="main_app.institution", | ||
), | ||
preserve_default=False, | ||
), | ||
migrations.AlterField( | ||
model_name="source", | ||
name="shelfmark", | ||
field=models.CharField( | ||
default="XX-NN", | ||
max_length=255, | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
from typing import Any | ||
from django.http.response import JsonResponse, HttpResponse | ||
from django.http.request import HttpRequest | ||
from django.core.exceptions import ImproperlyConfigured | ||
from django.template.response import TemplateResponse | ||
|
||
|
||
class JSONResponseMixin: | ||
""" | ||
Mixin to negotiate content type. Designed for use with | ||
DetailView and ListView classes only. | ||
If the request contains an `Accept` header with the value | ||
`application/json`, the response will be a JSON object. | ||
Otherwise, the response will render the HTML template as | ||
usual. | ||
The parent view must define an attribute "json_fields" that | ||
lists the fields to be included in the JSON response. | ||
""" | ||
|
||
def render_to_response( | ||
self, context: dict[Any, Any], **response_kwargs: dict[Any, Any] | ||
) -> HttpResponse: | ||
""" | ||
Returns a JSON response if the request accepts JSON. | ||
Otherwise, returns the default response. | ||
""" | ||
try: | ||
request: HttpRequest = self.request # type: ignore[attr-defined] | ||
except AttributeError as exc: | ||
raise ImproperlyConfigured( | ||
"A JSONResponseMixin must be used with a DetailView or ListView." | ||
) from exc | ||
try: | ||
json_fields = self.json_fields # type: ignore[attr-defined] | ||
except AttributeError as exc: | ||
raise ImproperlyConfigured( | ||
"A JSONResponseMixin must define a json_fields attribute." | ||
) from exc | ||
if "application/json" in request.META.get("HTTP_ACCEPT", ""): | ||
obj = context.get("object") | ||
if obj: | ||
obj_json = {} | ||
for field in json_fields: | ||
obj_json[field] = getattr(obj, field) | ||
return JsonResponse({obj.get_verbose_name(): obj_json}) | ||
q_s = context["object_list"].values(*json_fields) | ||
q_s_name = str(q_s.model.get_verbose_name_plural()) | ||
return JsonResponse({q_s_name: list(q_s)}) | ||
try: | ||
template_response: TemplateResponse = super().render_to_response( # type: ignore[misc] | ||
context, **response_kwargs | ||
) | ||
except AttributeError as exc: | ||
raise ImproperlyConfigured( | ||
"A JSONResponseMixin must be used with a DetailView or ListView." | ||
) from exc | ||
return template_response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.