annotate mysite/band/admin.py @ 10:10a8afa02eb2

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