annotate gpp/podcast/models.py @ 78:4edfea7f8620

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