annotate madeira/band/admin.py @ 43:ab83b727d97f

Getting rid of the SiteConfig model.
author Brian Neal <bgneal@gmail.com>
date Sun, 11 Mar 2012 14:29:42 -0500
parents 63e4211628e1
children 0176eca97d1d
rev   line source
bgneal@43 1 """
bgneal@43 2 Automatic admin definitions for the band models.
bgneal@1 3
bgneal@43 4 """
bgneal@1 5 from django.contrib import admin
bgneal@1 6
bgneal@40 7 from band.models import Article
bgneal@40 8 from band.models import Album
bgneal@40 9 from band.models import Album_Merchant
bgneal@40 10 from band.models import Album_Track
bgneal@40 11 from band.models import Band
bgneal@40 12 from band.models import City
bgneal@40 13 from band.models import Country
bgneal@40 14 from band.models import Fan
bgneal@40 15 from band.models import Gear
bgneal@40 16 from band.models import Gig
bgneal@40 17 from band.models import Label_Release
bgneal@40 18 from band.models import Member
bgneal@40 19 from band.models import Merchandise
bgneal@40 20 from band.models import Mp3
bgneal@40 21 from band.models import Mp3_Set
bgneal@40 22 from band.models import News
bgneal@40 23 from band.models import Record_Label
bgneal@40 24 from band.models import State
bgneal@40 25 from band.models import Venue
bgneal@40 26 from band.models import Video
bgneal@40 27 from band.models import Video_Set
bgneal@1 28
bgneal@1 29
bgneal@1 30 class GearInline(admin.TabularInline):
bgneal@1 31 model = Gear
bgneal@1 32
bgneal@43 33
bgneal@1 34 class GearAdmin(admin.ModelAdmin):
bgneal@1 35 list_display = ('item', 'member')
bgneal@1 36 list_filter = ('member', )
bgneal@1 37
bgneal@1 38
bgneal@1 39 class MemberAdmin(admin.ModelAdmin):
bgneal@1 40 list_display = ('name', 'instrument', 'is_active')
bgneal@1 41 inlines = [
bgneal@1 42 GearInline,
bgneal@1 43 ]
bgneal@1 44
bgneal@1 45
bgneal@1 46 class CityInline(admin.TabularInline):
bgneal@1 47 model = City
bgneal@1 48
bgneal@43 49
bgneal@1 50 class CityAdmin(admin.ModelAdmin):
bgneal@5 51 list_display = ('name', 'state', 'country')
bgneal@1 52 list_filter = ('state', )
bgneal@1 53 search_fields = ('name', )
bgneal@1 54
bgneal@5 55
bgneal@1 56 class StateAdmin(admin.ModelAdmin):
bgneal@1 57 inlines = [
bgneal@1 58 CityInline,
bgneal@1 59 ]
bgneal@1 60
bgneal@1 61
bgneal@1 62 class VenueAdmin(admin.ModelAdmin):
bgneal@1 63 list_filter = ('city', )
bgneal@1 64 list_display = ('name', 'city', )
bgneal@1 65 search_fields = ('name', )
bgneal@1 66
bgneal@1 67
bgneal@1 68 class BandAdmin(admin.ModelAdmin):
bgneal@1 69 search_fields = ('name', )
bgneal@1 70
bgneal@1 71
bgneal@1 72 class GigAdmin(admin.ModelAdmin):
bgneal@1 73 list_filter = ('date', 'venue')
bgneal@1 74 save_on_top = True
bgneal@1 75 filter_horizontal = ('bands', )
bgneal@1 76
bgneal@1 77
bgneal@1 78 class NewsAdmin(admin.ModelAdmin):
bgneal@1 79 save_on_top = True
bgneal@1 80 list_filter = ('date', )
bgneal@1 81 list_display = ('date', 'title')
bgneal@1 82 search_fields = ('text', 'title')
bgneal@1 83
bgneal@1 84
bgneal@1 85 class ArticleAdmin(admin.ModelAdmin):
bgneal@1 86 save_on_top = True
bgneal@1 87 list_filter = ('date', )
bgneal@1 88 list_display = ('title', 'date')
bgneal@1 89 search_fields = ('text', 'title')
bgneal@1 90
bgneal@1 91
bgneal@1 92 class Mp3Inline(admin.TabularInline):
bgneal@1 93 model = Mp3
bgneal@1 94
bgneal@43 95
bgneal@1 96 class Mp3Admin(admin.ModelAdmin):
bgneal@1 97 prepopulated_fields = {'slug' : ('title', 'desc')}
bgneal@1 98
bgneal@1 99
bgneal@1 100 class Mp3_SetAdmin(admin.ModelAdmin):
bgneal@1 101 list_filter = ('date', )
bgneal@1 102 list_display = ('title', 'date')
bgneal@1 103 inlines = [
bgneal@1 104 Mp3Inline,
bgneal@1 105 ]
bgneal@1 106
bgneal@1 107
bgneal@1 108 class VideoInline(admin.TabularInline):
bgneal@1 109 model = Video
bgneal@1 110
bgneal@43 111
bgneal@1 112 class Video_SetAdmin(admin.ModelAdmin):
bgneal@1 113 list_filter = ('date', )
bgneal@1 114 list_display = ('title', 'date')
bgneal@1 115 inlines = [
bgneal@1 116 VideoInline,
bgneal@1 117 ]
bgneal@1 118
bgneal@1 119
bgneal@1 120 class Album_TrackInline(admin.TabularInline):
bgneal@1 121 model = Album_Track
bgneal@1 122
bgneal@43 123
bgneal@1 124 class Album_TrackAdmin(admin.ModelAdmin):
bgneal@1 125 list_display = ('track_name', 'album')
bgneal@1 126 list_filter = ('album', )
bgneal@1 127
bgneal@1 128
bgneal@1 129 class Label_ReleaseInline(admin.TabularInline):
bgneal@1 130 model = Label_Release
bgneal@1 131
bgneal@43 132
bgneal@1 133 class Label_ReleaseAdmin(admin.ModelAdmin):
bgneal@1 134 list_display = ('catalog_number', 'album', 'record_label', 'release_date')
bgneal@1 135 list_filter = ('record_label', 'album')
bgneal@1 136
bgneal@1 137
bgneal@1 138 class Record_LabelAdmin(admin.ModelAdmin):
bgneal@1 139 inlines = [
bgneal@1 140 Label_ReleaseInline,
bgneal@1 141 ]
bgneal@1 142
bgneal@1 143
bgneal@1 144 class Album_MerchantInline(admin.TabularInline):
bgneal@1 145 model = Album_Merchant
bgneal@1 146
bgneal@43 147
bgneal@1 148 class Album_MerchantAdmin(admin.ModelAdmin):
bgneal@1 149 list_display = ('name', 'album')
bgneal@1 150 list_filter = ('album', )
bgneal@1 151
bgneal@1 152
bgneal@1 153 class AlbumAdmin(admin.ModelAdmin):
bgneal@1 154 save_on_top = True
bgneal@1 155 inlines = [
bgneal@1 156 Album_TrackInline,
bgneal@1 157 Label_ReleaseInline,
bgneal@1 158 Album_MerchantInline,
bgneal@1 159 ]
bgneal@1 160
bgneal@1 161
bgneal@1 162 class MerchandiseAdmin(admin.ModelAdmin):
bgneal@1 163 list_display = ('name', 'price', 'in_stock')
bgneal@1 164 list_filter = ('in_stock', )
bgneal@1 165
bgneal@1 166
bgneal@1 167 class FanAdmin(admin.ModelAdmin):
bgneal@1 168 list_display = ('name', 'email', 'current_status')
bgneal@1 169 search_fields = ('name', 'email')
bgneal@1 170
bgneal@43 171
bgneal@43 172 admin.site.register(Video)
bgneal@43 173 admin.site.register(Gear, GearAdmin)
bgneal@43 174 admin.site.register(Member, MemberAdmin)
bgneal@43 175 admin.site.register(City, CityAdmin)
bgneal@43 176 admin.site.register(Country)
bgneal@43 177 admin.site.register(State, StateAdmin)
bgneal@43 178 admin.site.register(Venue, VenueAdmin)
bgneal@43 179 admin.site.register(Band, BandAdmin)
bgneal@43 180 admin.site.register(Gig, GigAdmin)
bgneal@43 181 admin.site.register(News, NewsAdmin)
bgneal@43 182 admin.site.register(Article, ArticleAdmin)
bgneal@43 183 admin.site.register(Mp3, Mp3Admin)
bgneal@43 184 admin.site.register(Mp3_Set, Mp3_SetAdmin)
bgneal@43 185 admin.site.register(Video_Set, Video_SetAdmin)
bgneal@43 186 admin.site.register(Album_Track, Album_TrackAdmin)
bgneal@43 187 admin.site.register(Label_Release, Label_ReleaseAdmin)
bgneal@43 188 admin.site.register(Record_Label, Record_LabelAdmin)
bgneal@43 189 admin.site.register(Album_Merchant, Album_MerchantAdmin)
bgneal@43 190 admin.site.register(Album, AlbumAdmin)
bgneal@43 191 admin.site.register(Merchandise, MerchandiseAdmin)
bgneal@1 192 admin.site.register(Fan, FanAdmin)