source: telemeta/admin.py @ f6b65e4

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

Merge branch 'master' into security

Conflicts:

telemeta/admin.py

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