source: telemeta/admin.py @ f83d820

security
Last change on this file since f83d820 was f83d820, checked in by yomguy <yomguy@…>, 2 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
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
8<<<<<<< HEAD
9from django.forms import CheckboxSelectMultiple
10=======
11>>>>>>> master
12from django.contrib.auth.models import User
13from django.contrib.auth.admin import UserAdmin
14
15admin.site.unregister(User)
16
17class MediaFondsAdmin(admin.ModelAdmin):
18    search_fields = ['title', 'code']
19    ordering = ['code']
20    filter_horizontal = ['children']
21
22class MediaCorpusAdmin(admin.ModelAdmin):
23    search_fields = ['title', 'code']
24    ordering = ['code']
25    filter_horizontal = ['children']
26
27class MediaCollectionAdmin(admin.ModelAdmin):
28    search_fields = ['title', 'code']
29    ordering = ['code']
30
31class MediaCollectionRelatedAdmin(admin.ModelAdmin):
32    search_fields = ['title', 'description']
33
34class MediaItemAdmin(admin.ModelAdmin):
35    search_fields = ['title', 'code']
36    ordering = ['code']
37    exclude = ('copied_from_item', )
38
39class MediaItemRelatedAdmin(admin.ModelAdmin):
40    search_fields = ['title', 'description']
41
42class MediaPartAdmin(admin.ModelAdmin):
43    search_fields = ['title', 'item__code']
44    ordering = ['title']
45
46class InstrumentAdmin(admin.ModelAdmin):
47    search_fields = ['name']
48    ordering = ['name']
49
50class InstrumentAliasAdmin(admin.ModelAdmin):
51    search_fields = ['name']
52    ordering = ['name']
53
54class InstrumentRelationAdmin(admin.ModelAdmin):
55    search_fields = ['instrument__name', 'parent_instrument__name']
56    ordering = ['parent_instrument__name']
57
58class InstrumentAliasRelationAdmin(admin.ModelAdmin):
59    search_fields = ['alias__name', 'instrument__name']
60    ordering = ['alias__name']
61
62class LocationAdmin(admin.ModelAdmin):
63    search_fields = ['name']
64    ordering = ['name']
65
66class LocationAliasAdmin(admin.ModelAdmin):
67    search_fields = ['location__name', 'alias']
68    ordering = ['alias']
69
70class LocationRelationAdmin(admin.ModelAdmin):
71    search_fields = ['location__name', 'ancestor_location__name']
72    ordering = ['ancestor_location__name']
73
74class LanguageAdmin(admin.ModelAdmin):
75    search_fields = ['name', 'identifier']
76    ordering = ['name']
77
78class RevisionAdmin(admin.ModelAdmin):
79    search_fields = ['element_id', 'user']
80    ordering = ['-time']
81
82class FormatAdmin(admin.ModelAdmin):
83    search_fields = ['code', 'vendor']
84
85class UserProfileInline(admin.StackedInline):
86        model = UserProfile
87
88class UserProfileAdmin(UserAdmin):
89        inlines = [UserProfileInline]
90
91admin.site.register(MediaFonds, MediaFondsAdmin)
92admin.site.register(MediaCorpus, MediaCorpusAdmin)
93admin.site.register(MediaCollection, MediaCollectionAdmin)
94admin.site.register(MediaItem, MediaItemAdmin)
95admin.site.register(MediaPart, MediaPartAdmin)
96
97admin.site.register(MediaItemRelated, MediaItemRelatedAdmin)
98admin.site.register(MediaCollectionRelated, MediaCollectionRelatedAdmin)
99
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)
109
110admin.site.register(Language, LanguageAdmin)
111
112admin.site.register(Revision, RevisionAdmin)
113
114admin.site.register(Format, FormatAdmin)
115
116admin.site.register(User, UserProfileAdmin)
Note: See TracBrowser for help on using the repository browser.