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