summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErnesto Rico-Schmidt <e.rico.schmidt@gmail.com>2015-12-30 08:46:55 (GMT)
committerErnesto Rico-Schmidt <e.rico.schmidt@gmail.com>2015-12-30 08:46:55 (GMT)
commit35bf6baf07aeca3b1ea085939b60497e10c9a71f (patch)
tree3d510a688647d7722a9fd705e57876823f088e0d
parent6fb0d0a1b9be8ffb2ecce4ed87fd74ef684f2ef4 (diff)
replaced permalink calls, cleaned-up Show model
-rw-r--r--program/models.py20
1 files changed, 9 insertions, 11 deletions
diff --git a/program/models.py b/program/models.py
index 8bc0d6b..8013b84 100644
--- a/program/models.py
+++ b/program/models.py
@@ -1,5 +1,6 @@
from django.contrib.auth.models import User
from django.core.exceptions import ObjectDoesNotExist, ValidationError, MultipleObjectsReturned
+from django.core.urlresolvers import reverse
from django.db import models
from django.db.models import Q
from django.utils.translation import ugettext_lazy as _
@@ -221,19 +222,18 @@ class Host(models.Model):
def __unicode__(self):
return u'%s' % self.name
- @models.permalink
def get_absolute_url(self):
- return ('host-detail', [str(self.id)])
+ return reverse('host-detail', args=[self.id])
class Show(models.Model):
predecessor = models.ForeignKey('self', blank=True, null=True, related_name='successors', verbose_name=_("Predecessor"))
- hosts = models.ManyToManyField(Host, blank=True, null=True, related_name='shows', verbose_name=_("Hosts"))
- owners = models.ManyToManyField(User, blank=True, null=True, related_name='shows', verbose_name=_("Owners"))
+ hosts = models.ManyToManyField(Host, related_name='shows', verbose_name=_("Hosts"))
+ owners = models.ManyToManyField(User, related_name='shows', verbose_name=_("Owners"))
broadcastformat = models.ForeignKey(BroadcastFormat, related_name='shows', verbose_name=_("Broadcast format"))
- showinformation = models.ManyToManyField(ShowInformation, blank=True, null=True, related_name='shows', verbose_name=_("Show information"))
- showtopic = models.ManyToManyField(ShowTopic, blank=True, null=True, related_name='shows', verbose_name=_("Show topic"))
- musicfocus = models.ManyToManyField(MusicFocus, blank=True, null=True, related_name='shows', verbose_name=_("Music focus"))
+ showinformation = models.ManyToManyField(ShowInformation, related_name='shows', verbose_name=_("Show information"))
+ showtopic = models.ManyToManyField(ShowTopic, related_name='shows', verbose_name=_("Show topic"))
+ musicfocus = models.ManyToManyField(MusicFocus, related_name='shows', verbose_name=_("Music focus"))
name = models.CharField(_("Name"), max_length=255)
slug = models.CharField(_("Slug"), max_length=255, unique=True)
image = models.ImageField(_("Image"), blank=True, null=True, upload_to='show_images')
@@ -255,9 +255,8 @@ class Show(models.Model):
def __unicode__(self):
return u'%s' % self.name
- @models.permalink
def get_absolute_url(self):
- return ('show-detail', [self.slug])
+ return reverse('show-detail', args=[self.slug])
def has_active_programslots(self):
return self.programslots.filter(until__gt=date.today()).count() > 0
@@ -475,9 +474,8 @@ class TimeSlot(models.Model):
self.show = self.programslot.show
super(TimeSlot, self).save(*args, **kwargs)
- @models.permalink
def get_absolute_url(self):
- return ('timeslot-detail', [self.id])
+ return reverse('timeslot-detail', args=[self.id])
class Note(models.Model):