Mercurial > public > madeira
annotate mp3/models.py @ 101:0a8942306b04
Bootstrap work for mailing list page.
Also corrected form cleaning logic if fields aren't provided.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Wed, 16 Oct 2013 20:32:58 -0500 |
parents | e2868ad47a1e |
children |
rev | line source |
---|---|
bgneal@48 | 1 """ |
bgneal@48 | 2 Models for the mp3 application. |
bgneal@48 | 3 |
bgneal@48 | 4 """ |
bgneal@48 | 5 from django.db import models |
bgneal@48 | 6 |
bgneal@48 | 7 |
bgneal@48 | 8 class Collection(models.Model): |
bgneal@48 | 9 """ |
bgneal@48 | 10 This model represents a collection of songs. |
bgneal@48 | 11 |
bgneal@48 | 12 """ |
bgneal@48 | 13 title = models.CharField(max_length=64) |
bgneal@48 | 14 description = models.TextField() |
bgneal@48 | 15 date_added = models.DateTimeField() |
bgneal@48 | 16 |
bgneal@48 | 17 class Meta: |
bgneal@48 | 18 ordering = ['-date_added'] |
bgneal@48 | 19 |
bgneal@48 | 20 def __unicode__(self): |
bgneal@48 | 21 return self.title |
bgneal@48 | 22 |
bgneal@48 | 23 |
bgneal@48 | 24 class Song(models.Model): |
bgneal@48 | 25 """ |
bgneal@48 | 26 This model represents an uploaded song file. |
bgneal@48 | 27 |
bgneal@48 | 28 """ |
bgneal@48 | 29 title = models.CharField(max_length=64) |
bgneal@48 | 30 description = models.CharField(max_length=255, blank=True) |
bgneal@48 | 31 file = models.FileField(upload_to='mp3s/%Y/%m/%d/') |
bgneal@48 | 32 collection = models.ForeignKey(Collection) |
bgneal@48 | 33 |
bgneal@48 | 34 class Meta: |
bgneal@48 | 35 ordering = ['title'] |
bgneal@48 | 36 |
bgneal@48 | 37 def __unicode__(self): |
bgneal@48 | 38 return self.title |
bgneal@48 | 39 |