-
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 #1523 from DDMAL/develop
Merge develop into staging, 13 June 2024
- Loading branch information
Showing
50 changed files
with
961 additions
and
399 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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: django-tests | ||
on: | ||
pull_request: | ||
types: [opened, synchronize] | ||
jobs: | ||
run-tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- run: mkdir -p config/envs | ||
- uses: SpicyPizza/[email protected] | ||
with: | ||
envkey_POSTGRES_DB: test_cantusdb | ||
envkey_POSTGRES_USER: test_user | ||
envkey_POSTGRES_HOST: postgres | ||
envkey_POSTGRES_PORT: 5432 | ||
envkey_PROJECT_ENVIRONMENT: PRODUCTION | ||
envkey_CANTUSDB_STATIC_ROOT: /path/to/static | ||
envkey_CANTUSDB_MEDIA_ROOT: /path/to/media | ||
envkey_CANTUSDB_HOST: somehost | ||
envkey_CANTUSDB_SECRET_KEY: "hereisakey1234" | ||
envkey_POSTGRES_PASSWORD: woahagreatpasswordabc | ||
envkey_AWS_EMAIL_HOST_USER: test_user | ||
envkey_AWS_EMAIL_HOST_PASSWORD: test_password | ||
directory: config/envs | ||
file_name: dev_env | ||
- run: docker compose -f docker-compose-development.yml build | ||
- run: docker compose -f docker-compose-development.yml up -d | ||
- run: docker compose -f docker-compose-development.yml exec -T django python manage.py test main_app.tests |
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 was deleted.
Oops, something went wrong.
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,14 @@ | ||
from main_app.admin.century import CenturyAdmin | ||
from main_app.admin.chant import ChantAdmin | ||
from main_app.admin.differentia import DifferentiaAdmin | ||
from main_app.admin.feast import FeastAdmin | ||
from main_app.admin.genre import GenreAdmin | ||
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 | ||
from main_app.admin.institution import InstitutionAdmin | ||
from main_app.admin.institution_identifier import InstitutionIdentifierAdmin |
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,27 @@ | ||
from reversion.admin import VersionAdmin | ||
|
||
|
||
# these fields should not be editable by all classes | ||
EXCLUDE = ("json_info",) | ||
|
||
|
||
READ_ONLY = ( | ||
"created_by", | ||
"last_updated_by", | ||
"date_created", | ||
"date_updated", | ||
) | ||
|
||
|
||
class BaseModelAdmin(VersionAdmin): | ||
exclude = EXCLUDE | ||
readonly_fields = READ_ONLY | ||
|
||
# if an object is created in the admin interface, assign the user to the created_by field | ||
# else if an object is updated in the admin interface, assign the user to the last_updated_by field | ||
def save_model(self, request, obj, form, change): | ||
if change: | ||
obj.last_updated_by = request.user | ||
else: | ||
obj.created_by = request.user | ||
super().save_model(request, obj, form, change) |
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,11 @@ | ||
from django.contrib import admin | ||
|
||
from main_app.admin.base_admin import BaseModelAdmin | ||
from main_app.forms import AdminCenturyForm | ||
from main_app.models import Century | ||
|
||
|
||
@admin.register(Century) | ||
class CenturyAdmin(BaseModelAdmin): | ||
search_fields = ("name",) | ||
form = AdminCenturyForm |
Oops, something went wrong.