annotate mp3/models.py @ 97:f2e49c4496d8

Update requirements.txt for Django 1.5.4.
author Brian Neal <bgneal@gmail.com>
date Tue, 17 Sep 2013 21:10:22 -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