comparison gpp/podcast/models.py @ 1:dbd703f7d63a

Initial import of sg101 stuff from private repository.
author gremmie
date Mon, 06 Apr 2009 02:43:12 +0000
parents
children 1ed461fd2030
comparison
equal deleted inserted replaced
0:900ba3c7b765 1:dbd703f7d63a
1 """Models for the podcast application."""
2
3 from django.db import models
4
5 EXPLICIT_CHOICES = (
6 ('yes', 'Yes'),
7 ('no', 'No'),
8 ('clean', 'Clean'),
9 )
10
11
12 class Channel(models.Model):
13 """Model to represent the Channel properties"""
14
15 title = models.CharField(max_length=255)
16 link = models.URLField(verify_exists=False)
17 language = models.CharField(max_length=16)
18 copyright = models.CharField(max_length=255)
19 subtitle = models.CharField(max_length=255)
20 author = models.CharField(max_length=64)
21 description = models.CharField(max_length=255)
22 owner_name = models.CharField(max_length=64)
23 owner_email = models.EmailField()
24 image = models.ImageField(upload_to='podcast')
25 category = models.CharField(max_length=64)
26 explicit = models.CharField(max_length=8, choices=EXPLICIT_CHOICES)
27
28 def __unicode__(self):
29 return self.title
30
31
32 class Item(models.Model):
33 """Model to represent a channel item"""
34 channel = models.ForeignKey(Channel)
35 title = models.CharField(max_length=255)
36 author = models.CharField(max_length=255)
37 subtitle = models.CharField(max_length=255)
38 summary = models.TextField()
39 enclosure_url = models.URLField(verify_exists=False)
40 enclosure_length = models.IntegerField()
41 enclosure_type = models.CharField(max_length=32)
42 guid = models.CharField(max_length=255)
43 pubdate = models.DateTimeField()
44 duration = models.CharField(max_length=16)
45 keywords = models.CharField(max_length=255)
46 explicit = models.CharField(max_length=8, choices=EXPLICIT_CHOICES)
47
48 @models.permalink
49 def get_absolute_url(self):
50 return ('podcast.views.detail', [str(self.id)])
51
52 def __unicode__(self):
53 return self.title
54
55 class Meta:
56 ordering = ('-pubdate', )
57