bgneal@1
|
1 #######################################################################
|
bgneal@1
|
2 #
|
bgneal@1
|
3 # PyBand Copyright (C) 2008 by Brian Neal
|
bgneal@1
|
4 #
|
bgneal@1
|
5 #######################################################################
|
bgneal@1
|
6
|
bgneal@1
|
7 from django.contrib import admin
|
bgneal@1
|
8
|
bgneal@1
|
9 from mysite.band.models import Article
|
bgneal@1
|
10 from mysite.band.models import Album
|
bgneal@1
|
11 from mysite.band.models import Album_Merchant
|
bgneal@1
|
12 from mysite.band.models import Album_Track
|
bgneal@1
|
13 from mysite.band.models import Band
|
bgneal@1
|
14 from mysite.band.models import City
|
bgneal@1
|
15 from mysite.band.models import Fan
|
bgneal@1
|
16 from mysite.band.models import Gear
|
bgneal@1
|
17 from mysite.band.models import Gig
|
bgneal@1
|
18 from mysite.band.models import Label_Release
|
bgneal@1
|
19 from mysite.band.models import Member
|
bgneal@1
|
20 from mysite.band.models import Merchandise
|
bgneal@1
|
21 from mysite.band.models import Mp3
|
bgneal@1
|
22 from mysite.band.models import Mp3_Set
|
bgneal@1
|
23 from mysite.band.models import News
|
bgneal@1
|
24 from mysite.band.models import Record_Label
|
bgneal@1
|
25 from mysite.band.models import SiteConfig
|
bgneal@1
|
26 from mysite.band.models import State
|
bgneal@1
|
27 from mysite.band.models import Venue
|
bgneal@1
|
28 from mysite.band.models import Video
|
bgneal@1
|
29 from mysite.band.models import Video_Set
|
bgneal@1
|
30
|
bgneal@1
|
31 #######################################################################
|
bgneal@1
|
32
|
bgneal@1
|
33 admin.site.register(Video)
|
bgneal@1
|
34
|
bgneal@1
|
35 #######################################################################
|
bgneal@1
|
36
|
bgneal@1
|
37 class SiteConfigAdmin(admin.ModelAdmin):
|
bgneal@1
|
38 list_display = ('band_name', 'url', 'contact_email')
|
bgneal@1
|
39 fieldsets = (
|
bgneal@1
|
40 (None, { 'fields' : ('band_name', 'url', 'contact_email', 'intro_text', 'ordering_info',
|
bgneal@1
|
41 'intro_photo') }),
|
bgneal@1
|
42 )
|
bgneal@1
|
43
|
bgneal@1
|
44 admin.site.register(SiteConfig, SiteConfigAdmin)
|
bgneal@1
|
45
|
bgneal@1
|
46 #######################################################################
|
bgneal@1
|
47
|
bgneal@1
|
48 class GearInline(admin.TabularInline):
|
bgneal@1
|
49 model = Gear
|
bgneal@1
|
50
|
bgneal@1
|
51 class GearAdmin(admin.ModelAdmin):
|
bgneal@1
|
52 list_display = ('item', 'member')
|
bgneal@1
|
53 list_filter = ('member', )
|
bgneal@1
|
54
|
bgneal@1
|
55 admin.site.register(Gear, GearAdmin)
|
bgneal@1
|
56
|
bgneal@1
|
57 #######################################################################
|
bgneal@1
|
58
|
bgneal@1
|
59 class MemberAdmin(admin.ModelAdmin):
|
bgneal@1
|
60 list_display = ('name', 'instrument', 'is_active')
|
bgneal@1
|
61 inlines = [
|
bgneal@1
|
62 GearInline,
|
bgneal@1
|
63 ]
|
bgneal@1
|
64
|
bgneal@1
|
65 admin.site.register(Member, MemberAdmin)
|
bgneal@1
|
66
|
bgneal@1
|
67 #######################################################################
|
bgneal@1
|
68
|
bgneal@1
|
69 class CityInline(admin.TabularInline):
|
bgneal@1
|
70 model = City
|
bgneal@1
|
71
|
bgneal@1
|
72 class CityAdmin(admin.ModelAdmin):
|
bgneal@1
|
73 list_display = ('name', 'state')
|
bgneal@1
|
74 list_filter = ('state', )
|
bgneal@1
|
75 search_fields = ('name', )
|
bgneal@1
|
76
|
bgneal@1
|
77 admin.site.register(City, CityAdmin)
|
bgneal@1
|
78
|
bgneal@1
|
79 #######################################################################
|
bgneal@1
|
80
|
bgneal@1
|
81 class StateAdmin(admin.ModelAdmin):
|
bgneal@1
|
82 inlines = [
|
bgneal@1
|
83 CityInline,
|
bgneal@1
|
84 ]
|
bgneal@1
|
85
|
bgneal@1
|
86 admin.site.register(State, StateAdmin)
|
bgneal@1
|
87
|
bgneal@1
|
88 #######################################################################
|
bgneal@1
|
89
|
bgneal@1
|
90 class VenueAdmin(admin.ModelAdmin):
|
bgneal@1
|
91 list_filter = ('city', )
|
bgneal@1
|
92 list_display = ('name', 'city', )
|
bgneal@1
|
93 search_fields = ('name', )
|
bgneal@1
|
94
|
bgneal@1
|
95 admin.site.register(Venue, VenueAdmin)
|
bgneal@1
|
96
|
bgneal@1
|
97 #######################################################################
|
bgneal@1
|
98
|
bgneal@1
|
99 class BandAdmin(admin.ModelAdmin):
|
bgneal@1
|
100 search_fields = ('name', )
|
bgneal@1
|
101
|
bgneal@1
|
102 admin.site.register(Band, BandAdmin)
|
bgneal@1
|
103
|
bgneal@1
|
104 #######################################################################
|
bgneal@1
|
105
|
bgneal@1
|
106 class GigAdmin(admin.ModelAdmin):
|
bgneal@1
|
107 list_filter = ('date', 'venue')
|
bgneal@1
|
108 save_on_top = True
|
bgneal@1
|
109 filter_horizontal = ('bands', )
|
bgneal@1
|
110
|
bgneal@1
|
111 admin.site.register(Gig, GigAdmin)
|
bgneal@1
|
112
|
bgneal@1
|
113 #######################################################################
|
bgneal@1
|
114
|
bgneal@1
|
115 class NewsAdmin(admin.ModelAdmin):
|
bgneal@1
|
116 save_on_top = True
|
bgneal@1
|
117 list_filter = ('date', )
|
bgneal@1
|
118 list_display = ('date', 'title')
|
bgneal@1
|
119 search_fields = ('text', 'title')
|
bgneal@1
|
120
|
bgneal@1
|
121 admin.site.register(News, NewsAdmin)
|
bgneal@1
|
122
|
bgneal@1
|
123 #######################################################################
|
bgneal@1
|
124
|
bgneal@1
|
125 class ArticleAdmin(admin.ModelAdmin):
|
bgneal@1
|
126 save_on_top = True
|
bgneal@1
|
127 list_filter = ('date', )
|
bgneal@1
|
128 list_display = ('title', 'date')
|
bgneal@1
|
129 search_fields = ('text', 'title')
|
bgneal@1
|
130
|
bgneal@1
|
131 admin.site.register(Article, ArticleAdmin)
|
bgneal@1
|
132
|
bgneal@1
|
133 #######################################################################
|
bgneal@1
|
134
|
bgneal@1
|
135 class Mp3Inline(admin.TabularInline):
|
bgneal@1
|
136 model = Mp3
|
bgneal@1
|
137
|
bgneal@1
|
138 class Mp3Admin(admin.ModelAdmin):
|
bgneal@1
|
139 prepopulated_fields = {'slug' : ('title', 'desc')}
|
bgneal@1
|
140
|
bgneal@1
|
141 admin.site.register(Mp3, Mp3Admin)
|
bgneal@1
|
142
|
bgneal@1
|
143 #######################################################################
|
bgneal@1
|
144
|
bgneal@1
|
145 class Mp3_SetAdmin(admin.ModelAdmin):
|
bgneal@1
|
146 list_filter = ('date', )
|
bgneal@1
|
147 list_display = ('title', 'date')
|
bgneal@1
|
148 inlines = [
|
bgneal@1
|
149 Mp3Inline,
|
bgneal@1
|
150 ]
|
bgneal@1
|
151
|
bgneal@1
|
152 admin.site.register(Mp3_Set, Mp3_SetAdmin)
|
bgneal@1
|
153
|
bgneal@1
|
154 #######################################################################
|
bgneal@1
|
155
|
bgneal@1
|
156 class VideoInline(admin.TabularInline):
|
bgneal@1
|
157 model = Video
|
bgneal@1
|
158
|
bgneal@1
|
159 class Video_SetAdmin(admin.ModelAdmin):
|
bgneal@1
|
160 list_filter = ('date', )
|
bgneal@1
|
161 list_display = ('title', 'date')
|
bgneal@1
|
162 inlines = [
|
bgneal@1
|
163 VideoInline,
|
bgneal@1
|
164 ]
|
bgneal@1
|
165
|
bgneal@1
|
166 admin.site.register(Video_Set, Video_SetAdmin)
|
bgneal@1
|
167
|
bgneal@1
|
168 #######################################################################
|
bgneal@1
|
169
|
bgneal@1
|
170 class Album_TrackInline(admin.TabularInline):
|
bgneal@1
|
171 model = Album_Track
|
bgneal@1
|
172
|
bgneal@1
|
173 class Album_TrackAdmin(admin.ModelAdmin):
|
bgneal@1
|
174 list_display = ('track_name', 'album')
|
bgneal@1
|
175 list_filter = ('album', )
|
bgneal@1
|
176
|
bgneal@1
|
177 admin.site.register(Album_Track, Album_TrackAdmin)
|
bgneal@1
|
178
|
bgneal@1
|
179 #######################################################################
|
bgneal@1
|
180
|
bgneal@1
|
181 class Label_ReleaseInline(admin.TabularInline):
|
bgneal@1
|
182 model = Label_Release
|
bgneal@1
|
183
|
bgneal@1
|
184 class Label_ReleaseAdmin(admin.ModelAdmin):
|
bgneal@1
|
185 list_display = ('catalog_number', 'album', 'record_label', 'release_date')
|
bgneal@1
|
186 list_filter = ('record_label', 'album')
|
bgneal@1
|
187
|
bgneal@1
|
188 admin.site.register(Label_Release, Label_ReleaseAdmin)
|
bgneal@1
|
189
|
bgneal@1
|
190 #######################################################################
|
bgneal@1
|
191
|
bgneal@1
|
192 class Record_LabelAdmin(admin.ModelAdmin):
|
bgneal@1
|
193 inlines = [
|
bgneal@1
|
194 Label_ReleaseInline,
|
bgneal@1
|
195 ]
|
bgneal@1
|
196
|
bgneal@1
|
197 admin.site.register(Record_Label, Record_LabelAdmin)
|
bgneal@1
|
198
|
bgneal@1
|
199 #######################################################################
|
bgneal@1
|
200
|
bgneal@1
|
201 class Album_MerchantInline(admin.TabularInline):
|
bgneal@1
|
202 model = Album_Merchant
|
bgneal@1
|
203
|
bgneal@1
|
204 class Album_MerchantAdmin(admin.ModelAdmin):
|
bgneal@1
|
205 list_display = ('name', 'album')
|
bgneal@1
|
206 list_filter = ('album', )
|
bgneal@1
|
207
|
bgneal@1
|
208 admin.site.register(Album_Merchant, Album_MerchantAdmin)
|
bgneal@1
|
209
|
bgneal@1
|
210 #######################################################################
|
bgneal@1
|
211
|
bgneal@1
|
212 class AlbumAdmin(admin.ModelAdmin):
|
bgneal@1
|
213 save_on_top = True
|
bgneal@1
|
214 inlines = [
|
bgneal@1
|
215 Album_TrackInline,
|
bgneal@1
|
216 Label_ReleaseInline,
|
bgneal@1
|
217 Album_MerchantInline,
|
bgneal@1
|
218 ]
|
bgneal@1
|
219
|
bgneal@1
|
220 admin.site.register(Album, AlbumAdmin)
|
bgneal@1
|
221
|
bgneal@1
|
222 #######################################################################
|
bgneal@1
|
223
|
bgneal@1
|
224 class MerchandiseAdmin(admin.ModelAdmin):
|
bgneal@1
|
225 list_display = ('name', 'price', 'in_stock')
|
bgneal@1
|
226 list_filter = ('in_stock', )
|
bgneal@1
|
227
|
bgneal@1
|
228 admin.site.register(Merchandise, MerchandiseAdmin)
|
bgneal@1
|
229
|
bgneal@1
|
230 #######################################################################
|
bgneal@1
|
231
|
bgneal@1
|
232 class FanAdmin(admin.ModelAdmin):
|
bgneal@1
|
233 list_display = ('name', 'email', 'current_status')
|
bgneal@1
|
234 search_fields = ('name', 'email')
|
bgneal@1
|
235
|
bgneal@1
|
236 admin.site.register(Fan, FanAdmin)
|
bgneal@1
|
237
|
bgneal@1
|
238 #######################################################################
|
bgneal@1
|
239
|