annotate gpp/podcast/models.py @ 200:7d3e5aca095f

Fixing #73: comments no longer getting adding to web page on submit.
author Brian Neal <bgneal@gmail.com>
date Sun, 11 Apr 2010 19:41:13 +0000
parents 1ed461fd2030
children 76ad86454ce9
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)
bgneal@143 27 keywords = models.CharField(max_length=255)
gremmie@1 28
gremmie@1 29 def __unicode__(self):
gremmie@1 30 return self.title
gremmie@1 31
gremmie@1 32
gremmie@1 33 class Item(models.Model):
gremmie@1 34 """Model to represent a channel item"""
gremmie@1 35 channel = models.ForeignKey(Channel)
gremmie@1 36 title = models.CharField(max_length=255)
gremmie@1 37 author = models.CharField(max_length=255)
gremmie@1 38 subtitle = models.CharField(max_length=255)
gremmie@1 39 summary = models.TextField()
gremmie@1 40 enclosure_url = models.URLField(verify_exists=False)
bgneal@143 41 alt_enclosure_url = models.URLField(verify_exists=False, blank=True)
gremmie@1 42 enclosure_length = models.IntegerField()
gremmie@1 43 enclosure_type = models.CharField(max_length=32)
gremmie@1 44 guid = models.CharField(max_length=255)
gremmie@1 45 pubdate = models.DateTimeField()
gremmie@1 46 duration = models.CharField(max_length=16)
gremmie@1 47 keywords = models.CharField(max_length=255)
gremmie@1 48 explicit = models.CharField(max_length=8, choices=EXPLICIT_CHOICES)
gremmie@1 49
gremmie@1 50 @models.permalink
gremmie@1 51 def get_absolute_url(self):
gremmie@1 52 return ('podcast.views.detail', [str(self.id)])
gremmie@1 53
gremmie@1 54 def __unicode__(self):
gremmie@1 55 return self.title
gremmie@1 56
gremmie@1 57 class Meta:
gremmie@1 58 ordering = ('-pubdate', )
gremmie@1 59