bgneal@43: """
bgneal@43: Automatic admin definitions for the band models.
bgneal@1: 
bgneal@43: """
bgneal@1: from django.contrib import admin
bgneal@1: 
bgneal@40: from band.models import Album
bgneal@55: from band.models import AlbumMerchant
bgneal@55: from band.models import AlbumTrack
bgneal@40: from band.models import Gear
bgneal@55: from band.models import LabelRelease
bgneal@40: from band.models import Member
bgneal@40: from band.models import Merchandise
bgneal@55: from band.models import RecordLabel
bgneal@1: 
bgneal@1: 
bgneal@1: class GearInline(admin.TabularInline):
bgneal@55:     model = Gear
bgneal@1: 
bgneal@43: 
bgneal@1: class GearAdmin(admin.ModelAdmin):
bgneal@55:     list_display = ['item', 'member']
bgneal@55:     list_filter = ['member']
bgneal@1: 
bgneal@1: 
bgneal@1: class MemberAdmin(admin.ModelAdmin):
bgneal@55:     list_display = ['name', 'instrument', 'is_active']
bgneal@55:     inlines = [GearInline]
bgneal@1: 
bgneal@1: 
bgneal@55: class AlbumTrackInline(admin.TabularInline):
bgneal@55:     model = AlbumTrack
bgneal@1: 
bgneal@43: 
bgneal@55: class AlbumTrackAdmin(admin.ModelAdmin):
bgneal@55:     list_display = ['track_name', 'album']
bgneal@55:     list_filter = ['album']
bgneal@1: 
bgneal@5: 
bgneal@55: class LabelReleaseInline(admin.TabularInline):
bgneal@55:     model = LabelRelease
bgneal@1: 
bgneal@1: 
bgneal@55: class LabelReleaseAdmin(admin.ModelAdmin):
bgneal@55:     list_display = ['catalog_number', 'album', 'record_label', 'release_date']
bgneal@55:     list_filter = ['record_label', 'album']
bgneal@1: 
bgneal@1: 
bgneal@55: class RecordLabelAdmin(admin.ModelAdmin):
bgneal@55:     inlines = [LabelReleaseInline]
bgneal@1: 
bgneal@1: 
bgneal@55: class AlbumMerchantInline(admin.TabularInline):
bgneal@55:     model = AlbumMerchant
bgneal@1: 
bgneal@1: 
bgneal@55: class AlbumMerchantAdmin(admin.ModelAdmin):
bgneal@55:     list_display = ['name', 'album']
bgneal@55:     list_filter = ['album']
bgneal@1: 
bgneal@1: 
bgneal@1: class AlbumAdmin(admin.ModelAdmin):
bgneal@55:     save_on_top = True
bgneal@55:     inlines = [
bgneal@55:         AlbumTrackInline,
bgneal@55:         LabelReleaseInline,
bgneal@55:         AlbumMerchantInline,
bgneal@55:     ]
bgneal@1: 
bgneal@1: 
bgneal@1: class MerchandiseAdmin(admin.ModelAdmin):
bgneal@55:     list_display = ['name', 'price', 'in_stock']
bgneal@55:     list_filter = ['in_stock']
bgneal@1: 
bgneal@1: 
bgneal@43: admin.site.register(Gear, GearAdmin)
bgneal@43: admin.site.register(Member, MemberAdmin)
bgneal@55: admin.site.register(AlbumTrack, AlbumTrackAdmin)
bgneal@55: admin.site.register(LabelRelease, LabelReleaseAdmin)
bgneal@55: admin.site.register(RecordLabel, RecordLabelAdmin)
bgneal@55: admin.site.register(AlbumMerchant, AlbumMerchantAdmin)
bgneal@43: admin.site.register(Album, AlbumAdmin)
bgneal@43: admin.site.register(Merchandise, MerchandiseAdmin)