Skip to content

Commit

Permalink
Add languages to admin
Browse files Browse the repository at this point in the history
  • Loading branch information
jayvarner committed Jan 13, 2025
1 parent 1aed0ec commit deeb939
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions apps/iiif/manifests/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@

from django.contrib import admin
from django.http import HttpResponseRedirect
from django.http.request import HttpRequest
from django.urls import reverse
from django.urls.conf import path
from import_export import resources, fields
from import_export.admin import ImportExportModelAdmin
from import_export.widgets import ManyToManyWidget, ForeignKeyWidget
from django_summernote.admin import SummernoteModelAdmin
from .models import Manifest, Note, ImageServer, RelatedLink
from .documents import ManifestDocument
from .models import Manifest, Note, ImageServer, RelatedLink, Language
from .forms import ManifestAdminForm
from .views import AddToCollectionsView, MetadataImportView
from ..kollections.models import Collection
Expand Down Expand Up @@ -159,6 +156,22 @@ class ImageServerAdmin(ImportExportModelAdmin, admin.ModelAdmin):
list_display = ("server_base",)


class LanguageResource(resources.ModelResource):
"""Django admin Language resource."""

class Meta:
model = Language
fields = ("code", "name")


class LanguageAdmin(ImportExportModelAdmin, admin.ModelAdmin):
"""Django admin settings for Language."""

resource_class = LanguageResource
list_display = ("name", "code")


admin.site.register(Manifest, ManifestAdmin)
admin.site.register(Note, NoteAdmin)
admin.site.register(ImageServer, ImageServerAdmin)
admin.site.register(Language, LanguageAdmin)

0 comments on commit deeb939

Please sign in to comment.