source: telemeta/admin.py @ f83d820

security
Last change on this file since f83d820 was f83d820, checked in by yomguy <yomguy@…>, 3 years ago

Merge branch 'master' into security

Conflicts:

telemeta/admin.py
telemeta/models/system.py

  • Property mode set to 100644
File size: 3.5 KB
RevLine 
[fee90af]1# -*- coding: utf-8 -*-
[a8911fd]2from telemeta.models.media import *
3from telemeta.models.instrument import *
[9b8448b]4from telemeta.models.location import *
[44cc478]5from telemeta.models.language import *
[3f143f5]6from telemeta.models.system import *
[3d49f41]7from django.contrib import admin
[f83d820]8<<<<<<< HEAD
[d5b2406]9from django.forms import CheckboxSelectMultiple
[f83d820]10=======
11>>>>>>> master
[16d8a31]12from django.contrib.auth.models import User
13from django.contrib.auth.admin import UserAdmin
14
15admin.site.unregister(User)
[9b8448b]16
[566f17d]17class MediaFondsAdmin(admin.ModelAdmin):
[a50bf1e]18    search_fields = ['title', 'code']
19    ordering = ['code']
[fabced9]20    filter_horizontal = ['children']
[a50bf1e]21
22class MediaCorpusAdmin(admin.ModelAdmin):
23    search_fields = ['title', 'code']
24    ordering = ['code']
[fabced9]25    filter_horizontal = ['children']
[bfa68c2]26
[9b8448b]27class MediaCollectionAdmin(admin.ModelAdmin):
28    search_fields = ['title', 'code']
[d131c76]29    ordering = ['code']
[9b8448b]30
[a50bf1e]31class MediaCollectionRelatedAdmin(admin.ModelAdmin):
32    search_fields = ['title', 'description']
33
[9b8448b]34class MediaItemAdmin(admin.ModelAdmin):
35    search_fields = ['title', 'code']
[d131c76]36    ordering = ['code']
[3aa1a85]37    exclude = ('copied_from_item', )
[9b8448b]38
[482c7bd]39class MediaItemRelatedAdmin(admin.ModelAdmin):
[7bb5f60]40    search_fields = ['title', 'description']
[44cc478]41
[9b8448b]42class MediaPartAdmin(admin.ModelAdmin):
[d131c76]43    search_fields = ['title', 'item__code']
44    ordering = ['title']
[9b8448b]45
46class InstrumentAdmin(admin.ModelAdmin):
[d131c76]47    search_fields = ['name']
48    ordering = ['name']
[44cc478]49
[9b8448b]50class InstrumentAliasAdmin(admin.ModelAdmin):
[d131c76]51    search_fields = ['name']
52    ordering = ['name']
[9b8448b]53
54class InstrumentRelationAdmin(admin.ModelAdmin):
[d131c76]55    search_fields = ['instrument__name', 'parent_instrument__name']
56    ordering = ['parent_instrument__name']
[44cc478]57
[9b8448b]58class InstrumentAliasRelationAdmin(admin.ModelAdmin):
[d131c76]59    search_fields = ['alias__name', 'instrument__name']
60    ordering = ['alias__name']
[9b8448b]61
62class LocationAdmin(admin.ModelAdmin):
[d131c76]63    search_fields = ['name']
64    ordering = ['name']
[44cc478]65
[9b8448b]66class LocationAliasAdmin(admin.ModelAdmin):
[d131c76]67    search_fields = ['location__name', 'alias']
68    ordering = ['alias']
[44cc478]69
[9b8448b]70class LocationRelationAdmin(admin.ModelAdmin):
[d131c76]71    search_fields = ['location__name', 'ancestor_location__name']
72    ordering = ['ancestor_location__name']
[9b8448b]73
[44cc478]74class LanguageAdmin(admin.ModelAdmin):
75    search_fields = ['name', 'identifier']
76    ordering = ['name']
77
[3f143f5]78class RevisionAdmin(admin.ModelAdmin):
79    search_fields = ['element_id', 'user']
80    ordering = ['-time']
81
[7ed402e]82class FormatAdmin(admin.ModelAdmin):
83    search_fields = ['code', 'vendor']
[44cc478]84
[16d8a31]85class UserProfileInline(admin.StackedInline):
86        model = UserProfile
87
88class UserProfileAdmin(UserAdmin):
89        inlines = [UserProfileInline]
90
[566f17d]91admin.site.register(MediaFonds, MediaFondsAdmin)
[a50bf1e]92admin.site.register(MediaCorpus, MediaCorpusAdmin)
[9b8448b]93admin.site.register(MediaCollection, MediaCollectionAdmin)
[3aa1a85]94admin.site.register(MediaItem, MediaItemAdmin)
[9b8448b]95admin.site.register(MediaPart, MediaPartAdmin)
[a50bf1e]96
[482c7bd]97admin.site.register(MediaItemRelated, MediaItemRelatedAdmin)
[a50bf1e]98admin.site.register(MediaCollectionRelated, MediaCollectionRelatedAdmin)
99
[9b8448b]100admin.site.register(Instrument, InstrumentAdmin)
101admin.site.register(InstrumentAlias, InstrumentAliasAdmin)
102admin.site.register(InstrumentRelation, InstrumentRelationAdmin)
103admin.site.register(InstrumentAliasRelation, InstrumentAliasRelationAdmin)
104
105admin.site.register(Location, LocationAdmin)
106#admin.site.register(LocationType)
107admin.site.register(LocationAlias, LocationAliasAdmin)
108admin.site.register(LocationRelation, LocationRelationAdmin)
[3d49f41]109
[44cc478]110admin.site.register(Language, LanguageAdmin)
[3f143f5]111
112admin.site.register(Revision, RevisionAdmin)
[7ed402e]113
114admin.site.register(Format, FormatAdmin)
[16d8a31]115
116admin.site.register(User, UserProfileAdmin)
Note: See TracBrowser for help on using the repository browser.