comparison podcast/models.py @ 1032:e932f2ecd4a7

Django 1.8 warnings / tech debt cleanup.
author Brian Neal <bgneal@gmail.com>
date Sat, 26 Dec 2015 15:10:55 -0600
parents ee87ea74d46b
children
comparison
equal deleted inserted replaced
1031:e1c03da72818 1032:e932f2ecd4a7
2 Models for the podcast application. 2 Models for the podcast application.
3 3
4 """ 4 """
5 import datetime 5 import datetime
6 6
7 from django.core.urlresolvers import reverse
7 from django.db import models 8 from django.db import models
8 9
9 10
10 EXPLICIT_CHOICES = ( 11 EXPLICIT_CHOICES = [
11 ('yes', 'Yes'), 12 ('yes', 'Yes'),
12 ('no', 'No'), 13 ('no', 'No'),
13 ('clean', 'Clean'), 14 ('clean', 'Clean'),
14 ) 15 ]
15 16
16 17
17 class Channel(models.Model): 18 class Channel(models.Model):
18 """Model to represent the Channel properties""" 19 """Model to represent the Channel properties"""
19 20
51 duration = models.CharField(max_length=16) 52 duration = models.CharField(max_length=16)
52 keywords = models.CharField(max_length=255) 53 keywords = models.CharField(max_length=255)
53 explicit = models.CharField(max_length=8, choices=EXPLICIT_CHOICES) 54 explicit = models.CharField(max_length=8, choices=EXPLICIT_CHOICES)
54 update_date = models.DateTimeField(db_index=True, blank=True) 55 update_date = models.DateTimeField(db_index=True, blank=True)
55 56
56 @models.permalink
57 def get_absolute_url(self): 57 def get_absolute_url(self):
58 return ('podcast.views.detail', [str(self.id)]) 58 return reverse('podcast-detail', args=[str(self.id)])
59 59
60 def __unicode__(self): 60 def __unicode__(self):
61 return self.title 61 return self.title
62 62
63 class Meta: 63 class Meta:
64 ordering = ('-pubdate', ) 64 ordering = ['-pubdate']
65 verbose_name = 'podcast' 65 verbose_name = 'podcast'
66 verbose_name_plural = 'podcasts' 66 verbose_name_plural = 'podcasts'
67 67
68 def save(self, *args, **kwargs): 68 def save(self, *args, **kwargs):
69 if not self.id: 69 if not self.id: