annotate band/admin.py @ 176:5e58f89d3dd8

New band photo on home page. Also added Ancient Winds album cover as a headline.
author Brian Neal <bgneal@gmail.com>
date Thu, 20 Aug 2015 19:49:50 -0500
parents e2868ad47a1e
children
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 Album
bgneal@55 8 from band.models import AlbumMerchant
bgneal@55 9 from band.models import AlbumTrack
bgneal@40 10 from band.models import Gear
bgneal@55 11 from band.models import LabelRelease
bgneal@40 12 from band.models import Member
bgneal@40 13 from band.models import Merchandise
bgneal@55 14 from band.models import RecordLabel
bgneal@1 15
bgneal@1 16
bgneal@1 17 class GearInline(admin.TabularInline):
bgneal@55 18 model = Gear
bgneal@1 19
bgneal@43 20
bgneal@1 21 class GearAdmin(admin.ModelAdmin):
bgneal@55 22 list_display = ['item', 'member']
bgneal@55 23 list_filter = ['member']
bgneal@1 24
bgneal@1 25
bgneal@1 26 class MemberAdmin(admin.ModelAdmin):
bgneal@55 27 list_display = ['name', 'instrument', 'is_active']
bgneal@55 28 inlines = [GearInline]
bgneal@1 29
bgneal@1 30
bgneal@55 31 class AlbumTrackInline(admin.TabularInline):
bgneal@55 32 model = AlbumTrack
bgneal@1 33
bgneal@43 34
bgneal@55 35 class AlbumTrackAdmin(admin.ModelAdmin):
bgneal@55 36 list_display = ['track_name', 'album']
bgneal@55 37 list_filter = ['album']
bgneal@1 38
bgneal@5 39
bgneal@55 40 class LabelReleaseInline(admin.TabularInline):
bgneal@55 41 model = LabelRelease
bgneal@1 42
bgneal@1 43
bgneal@55 44 class LabelReleaseAdmin(admin.ModelAdmin):
bgneal@55 45 list_display = ['catalog_number', 'album', 'record_label', 'release_date']
bgneal@55 46 list_filter = ['record_label', 'album']
bgneal@1 47
bgneal@1 48
bgneal@55 49 class RecordLabelAdmin(admin.ModelAdmin):
bgneal@55 50 inlines = [LabelReleaseInline]
bgneal@1 51
bgneal@1 52
bgneal@55 53 class AlbumMerchantInline(admin.TabularInline):
bgneal@55 54 model = AlbumMerchant
bgneal@1 55
bgneal@1 56
bgneal@55 57 class AlbumMerchantAdmin(admin.ModelAdmin):
bgneal@55 58 list_display = ['name', 'album']
bgneal@55 59 list_filter = ['album']
bgneal@1 60
bgneal@1 61
bgneal@1 62 class AlbumAdmin(admin.ModelAdmin):
bgneal@55 63 save_on_top = True
bgneal@55 64 inlines = [
bgneal@55 65 AlbumTrackInline,
bgneal@55 66 LabelReleaseInline,
bgneal@55 67 AlbumMerchantInline,
bgneal@55 68 ]
bgneal@1 69
bgneal@1 70
bgneal@1 71 class MerchandiseAdmin(admin.ModelAdmin):
bgneal@55 72 list_display = ['name', 'price', 'in_stock']
bgneal@55 73 list_filter = ['in_stock']
bgneal@1 74
bgneal@1 75
bgneal@43 76 admin.site.register(Gear, GearAdmin)
bgneal@43 77 admin.site.register(Member, MemberAdmin)
bgneal@55 78 admin.site.register(AlbumTrack, AlbumTrackAdmin)
bgneal@55 79 admin.site.register(LabelRelease, LabelReleaseAdmin)
bgneal@55 80 admin.site.register(RecordLabel, RecordLabelAdmin)
bgneal@55 81 admin.site.register(AlbumMerchant, AlbumMerchantAdmin)
bgneal@43 82 admin.site.register(Album, AlbumAdmin)
bgneal@43 83 admin.site.register(Merchandise, MerchandiseAdmin)