source: telemeta/admin.py @ a62ff5a

cremcrem2devdev2diademsfeature/breadcrumbsfeature/ts-0.5feature/ts-0.5.4feature/writecacheformagenericinstru_searchlamlam2mapsv3mergenlivemultiproductionrelease/1.4.4sabiodsecurityserversocialstoragetelecastertest
Last change on this file since a62ff5a was 7ed402e, checked in by yomguy <yomguy@…>, 2 years ago

add Format (LAM) and various enumerations, add last revision to item detail

  • Property mode set to 100644
File size: 3.2 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
9
10class MediaFondsAdmin(admin.ModelAdmin):
11    search_fields = ['title', 'code']
12    ordering = ['code']
13
14class MediaCorpusAdmin(admin.ModelAdmin):
15    search_fields = ['title', 'code']
16    ordering = ['code']
17    formfield_overrides = {
18        models.ManyToManyField: {'widget': CheckboxSelectMultiple}
19        }
20
21class MediaCollectionAdmin(admin.ModelAdmin):
22    search_fields = ['title', 'code']
23    ordering = ['code']
24
25class MediaCollectionRelatedAdmin(admin.ModelAdmin):
26    search_fields = ['title', 'description']
27
28class MediaItemAdmin(admin.ModelAdmin):
29    search_fields = ['title', 'code']
30    ordering = ['code']
31    exclude = ('copied_from_item', )
32
33class MediaItemRelatedAdmin(admin.ModelAdmin):
34    search_fields = ['title', 'description']
35
36class MediaPartAdmin(admin.ModelAdmin):
37    search_fields = ['title', 'item__code']
38    ordering = ['title']
39
40class InstrumentAdmin(admin.ModelAdmin):
41    search_fields = ['name']
42    ordering = ['name']
43
44class InstrumentAliasAdmin(admin.ModelAdmin):
45    search_fields = ['name']
46    ordering = ['name']
47
48class InstrumentRelationAdmin(admin.ModelAdmin):
49    search_fields = ['instrument__name', 'parent_instrument__name']
50    ordering = ['parent_instrument__name']
51
52class InstrumentAliasRelationAdmin(admin.ModelAdmin):
53    search_fields = ['alias__name', 'instrument__name']
54    ordering = ['alias__name']
55
56class LocationAdmin(admin.ModelAdmin):
57    search_fields = ['name']
58    ordering = ['name']
59
60class LocationAliasAdmin(admin.ModelAdmin):
61    search_fields = ['location__name', 'alias']
62    ordering = ['alias']
63
64class LocationRelationAdmin(admin.ModelAdmin):
65    search_fields = ['location__name', 'ancestor_location__name']
66    ordering = ['ancestor_location__name']
67
68class LanguageAdmin(admin.ModelAdmin):
69    search_fields = ['name', 'identifier']
70    ordering = ['name']
71
72class RevisionAdmin(admin.ModelAdmin):
73    search_fields = ['element_id', 'user']
74    ordering = ['-time']
75
76class FormatAdmin(admin.ModelAdmin):
77    search_fields = ['code', 'vendor']
78
79admin.site.register(MediaFonds, MediaFondsAdmin)
80admin.site.register(MediaCorpus, MediaCorpusAdmin)
81admin.site.register(MediaCollection, MediaCollectionAdmin)
82admin.site.register(MediaItem, MediaItemAdmin)
83admin.site.register(MediaPart, MediaPartAdmin)
84
85admin.site.register(MediaItemRelated, MediaItemRelatedAdmin)
86admin.site.register(MediaCollectionRelated, MediaCollectionRelatedAdmin)
87
88admin.site.register(Instrument, InstrumentAdmin)
89admin.site.register(InstrumentAlias, InstrumentAliasAdmin)
90admin.site.register(InstrumentRelation, InstrumentRelationAdmin)
91admin.site.register(InstrumentAliasRelation, InstrumentAliasRelationAdmin)
92
93admin.site.register(Location, LocationAdmin)
94#admin.site.register(LocationType)
95admin.site.register(LocationAlias, LocationAliasAdmin)
96admin.site.register(LocationRelation, LocationRelationAdmin)
97
98admin.site.register(Language, LanguageAdmin)
99
100admin.site.register(Revision, RevisionAdmin)
101
102admin.site.register(Format, FormatAdmin)
Note: See TracBrowser for help on using the repository browser.