gremmie@1: """Models for the podcast application.""" gremmie@1: gremmie@1: from django.db import models gremmie@1: gremmie@1: EXPLICIT_CHOICES = ( gremmie@1: ('yes', 'Yes'), gremmie@1: ('no', 'No'), gremmie@1: ('clean', 'Clean'), gremmie@1: ) gremmie@1: gremmie@1: gremmie@1: class Channel(models.Model): gremmie@1: """Model to represent the Channel properties""" gremmie@1: gremmie@1: title = models.CharField(max_length=255) gremmie@1: link = models.URLField(verify_exists=False) gremmie@1: language = models.CharField(max_length=16) gremmie@1: copyright = models.CharField(max_length=255) gremmie@1: subtitle = models.CharField(max_length=255) gremmie@1: author = models.CharField(max_length=64) gremmie@1: description = models.CharField(max_length=255) gremmie@1: owner_name = models.CharField(max_length=64) gremmie@1: owner_email = models.EmailField() gremmie@1: image = models.ImageField(upload_to='podcast') gremmie@1: category = models.CharField(max_length=64) gremmie@1: explicit = models.CharField(max_length=8, choices=EXPLICIT_CHOICES) bgneal@143: keywords = models.CharField(max_length=255) gremmie@1: gremmie@1: def __unicode__(self): gremmie@1: return self.title gremmie@1: gremmie@1: gremmie@1: class Item(models.Model): gremmie@1: """Model to represent a channel item""" gremmie@1: channel = models.ForeignKey(Channel) gremmie@1: title = models.CharField(max_length=255) gremmie@1: author = models.CharField(max_length=255) gremmie@1: subtitle = models.CharField(max_length=255) gremmie@1: summary = models.TextField() gremmie@1: enclosure_url = models.URLField(verify_exists=False) bgneal@143: alt_enclosure_url = models.URLField(verify_exists=False, blank=True) gremmie@1: enclosure_length = models.IntegerField() gremmie@1: enclosure_type = models.CharField(max_length=32) gremmie@1: guid = models.CharField(max_length=255) gremmie@1: pubdate = models.DateTimeField() gremmie@1: duration = models.CharField(max_length=16) gremmie@1: keywords = models.CharField(max_length=255) gremmie@1: explicit = models.CharField(max_length=8, choices=EXPLICIT_CHOICES) gremmie@1: gremmie@1: @models.permalink gremmie@1: def get_absolute_url(self): gremmie@1: return ('podcast.views.detail', [str(self.id)]) gremmie@1: gremmie@1: def __unicode__(self): gremmie@1: return self.title gremmie@1: gremmie@1: class Meta: gremmie@1: ordering = ('-pubdate', ) gremmie@1: