Mercurial > public > madeira
comparison mp3/models.py @ 71:e2868ad47a1e
For Django 1.4, using the new manage.py.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sat, 14 Apr 2012 16:40:29 -0500 |
parents | madeira/mp3/models.py@b8a71c767dc0 |
children |
comparison
equal
deleted
inserted
replaced
70:f26cdda0ad8b | 71:e2868ad47a1e |
---|---|
1 """ | |
2 Models for the mp3 application. | |
3 | |
4 """ | |
5 from django.db import models | |
6 | |
7 | |
8 class Collection(models.Model): | |
9 """ | |
10 This model represents a collection of songs. | |
11 | |
12 """ | |
13 title = models.CharField(max_length=64) | |
14 description = models.TextField() | |
15 date_added = models.DateTimeField() | |
16 | |
17 class Meta: | |
18 ordering = ['-date_added'] | |
19 | |
20 def __unicode__(self): | |
21 return self.title | |
22 | |
23 | |
24 class Song(models.Model): | |
25 """ | |
26 This model represents an uploaded song file. | |
27 | |
28 """ | |
29 title = models.CharField(max_length=64) | |
30 description = models.CharField(max_length=255, blank=True) | |
31 file = models.FileField(upload_to='mp3s/%Y/%m/%d/') | |
32 collection = models.ForeignKey(Collection) | |
33 | |
34 class Meta: | |
35 ordering = ['title'] | |
36 | |
37 def __unicode__(self): | |
38 return self.title | |
39 |