bgneal@55: """ bgneal@55: Models for the band application. bgneal@55: bgneal@55: """ bgneal@1: from django.db import models bgneal@1: bgneal@40: from photologue.models import Photo bgneal@1: bgneal@1: bgneal@1: class Member(models.Model): bgneal@55: name = models.CharField(max_length=50) bgneal@55: nickname = models.CharField(max_length=50, blank=True) bgneal@55: instrument = models.CharField(max_length=255) bgneal@55: bio = models.TextField(blank=True) bgneal@55: photo = models.ImageField(upload_to='images/bio/', blank=True) bgneal@55: order = models.SmallIntegerField( bgneal@55: help_text = "Controls order of display; lower numbers displayed first") bgneal@55: is_active = models.BooleanField() bgneal@55: start_date = models.DateField() bgneal@55: end_date = models.DateField(blank=True, bgneal@55: null=True, bgneal@55: help_text="Only used if the member is not active") bgneal@55: email = models.EmailField() bgneal@5: bgneal@5: def __unicode__(self): bgneal@5: return self.name bgneal@5: bgneal@55: class Meta: bgneal@55: ordering = ['-is_active', 'name'] bgneal@5: bgneal@1: bgneal@55: class Gear(models.Model): bgneal@55: member = models.ForeignKey(Member) bgneal@55: item = models.CharField(max_length=255) bgneal@1: bgneal@55: def __unicode__(self): bgneal@55: return self.item bgneal@1: bgneal@55: class Meta: bgneal@55: verbose_name_plural = 'Gear List' bgneal@1: bgneal@1: bgneal@55: class RecordLabel(models.Model): bgneal@55: name = models.CharField(max_length=64) bgneal@64: url = models.URLField(max_length=200) bgneal@1: bgneal@55: def __unicode__(self): bgneal@55: return self.name bgneal@1: bgneal@1: bgneal@1: class Album(models.Model): bgneal@55: title = models.CharField(max_length=64) bgneal@55: photo = models.ForeignKey(Photo) bgneal@55: desc = models.TextField(blank=True) bgneal@1: bgneal@55: def __unicode__(self): bgneal@55: return self.title bgneal@1: bgneal@1: bgneal@55: class AlbumTrack(models.Model): bgneal@57: album = models.ForeignKey(Album, related_name='tracks') bgneal@55: track_number = models.SmallIntegerField() bgneal@55: track_name = models.CharField(max_length=64) bgneal@1: bgneal@55: def __unicode__(self): bgneal@55: return self.track_name bgneal@1: bgneal@55: class Meta: bgneal@55: verbose_name = 'Album Track' bgneal@55: ordering = ['album', 'track_number'] bgneal@1: bgneal@1: bgneal@55: class LabelRelease(models.Model): bgneal@55: record_label = models.ForeignKey(RecordLabel) bgneal@57: album = models.ForeignKey(Album, related_name='labels') bgneal@55: catalog_number = models.CharField(max_length=32) bgneal@55: release_date = models.DateField() bgneal@1: bgneal@55: def __unicode__(self): bgneal@55: return u'%s %s %s' % (self.record_label.name, self.album.title, bgneal@55: self.catalog_number) bgneal@1: bgneal@55: class Meta: bgneal@55: verbose_name = 'Label Release' bgneal@1: bgneal@1: bgneal@55: class AlbumMerchant(models.Model): bgneal@57: album = models.ForeignKey(Album, related_name='merchants') bgneal@55: name = models.CharField(max_length=64) bgneal@64: url = models.URLField(max_length=200) bgneal@1: bgneal@55: def __unicode__(self): bgneal@55: return u'%s (%s)' % (self.name, self.album.title) bgneal@1: bgneal@55: class Meta: bgneal@55: verbose_name = 'Album Merchant' bgneal@55: ordering = ['name'] bgneal@1: bgneal@1: bgneal@1: class Merchandise(models.Model): bgneal@55: name = models.CharField(max_length=64) bgneal@55: desc = models.TextField() bgneal@55: price = models.DecimalField(max_digits=5, decimal_places=2) bgneal@55: in_stock = models.BooleanField() bgneal@55: photo = models.ForeignKey(Photo) bgneal@1: bgneal@55: def __unicode__(self): bgneal@55: return self.name bgneal@1: bgneal@55: class Meta: bgneal@55: verbose_name_plural = "Merchandise"