Skip to content

Commit

Permalink
Merge pull request #1663 from DDMAL/develop
Browse files Browse the repository at this point in the history
Merge `develop` into `staging`, 11 Oct 2024
  • Loading branch information
dchiller authored Oct 11, 2024
2 parents 1e4c4cd + 97a13c6 commit 8ca73e2
Show file tree
Hide file tree
Showing 33 changed files with 1,126 additions and 612 deletions.
13 changes: 12 additions & 1 deletion django/cantusdb_project/main_app/admin/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
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
from main_app.models import Source, SourceIdentifier


class SourceKeyFilter(InputFilter):
Expand All @@ -15,10 +15,19 @@ def queryset(self, request, queryset):
return queryset.filter(holding_institution__siglum__icontains=self.value())


class IdentifiersInline(admin.TabularInline):
model = SourceIdentifier
extra = 0

def get_queryset(self, request):
return super().get_queryset(request).select_related("source__holding_institution")


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

# These search fields are also available on the user-source inline relationship in the user admin page
search_fields = (
Expand All @@ -28,6 +37,8 @@ class SourceAdmin(BaseModelAdmin):
"holding_institution__migrated_identifier",
"id",
"provenance_notes",
"name",
"identifiers__identifier"
)
readonly_fields = (
("title", "siglum")
Expand Down
Loading

0 comments on commit 8ca73e2

Please sign in to comment.