Mercurial > public > sg101
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gpp/podcast/models.py Mon Apr 06 02:43:12 2009 +0000 @@ -0,0 +1,57 @@ +"""Models for the podcast application.""" + +from django.db import models + +EXPLICIT_CHOICES = ( + ('yes', 'Yes'), + ('no', 'No'), + ('clean', 'Clean'), + ) + + +class Channel(models.Model): + """Model to represent the Channel properties""" + + title = models.CharField(max_length=255) + link = models.URLField(verify_exists=False) + language = models.CharField(max_length=16) + copyright = models.CharField(max_length=255) + subtitle = models.CharField(max_length=255) + author = models.CharField(max_length=64) + description = models.CharField(max_length=255) + owner_name = models.CharField(max_length=64) + owner_email = models.EmailField() + image = models.ImageField(upload_to='podcast') + category = models.CharField(max_length=64) + explicit = models.CharField(max_length=8, choices=EXPLICIT_CHOICES) + + def __unicode__(self): + return self.title + + +class Item(models.Model): + """Model to represent a channel item""" + channel = models.ForeignKey(Channel) + title = models.CharField(max_length=255) + author = models.CharField(max_length=255) + subtitle = models.CharField(max_length=255) + summary = models.TextField() + enclosure_url = models.URLField(verify_exists=False) + enclosure_length = models.IntegerField() + enclosure_type = models.CharField(max_length=32) + guid = models.CharField(max_length=255) + pubdate = models.DateTimeField() + duration = models.CharField(max_length=16) + keywords = models.CharField(max_length=255) + explicit = models.CharField(max_length=8, choices=EXPLICIT_CHOICES) + + @models.permalink + def get_absolute_url(self): + return ('podcast.views.detail', [str(self.id)]) + + def __unicode__(self): + return self.title + + class Meta: + ordering = ('-pubdate', ) +