From: Matthijs Kooijman Date: Fri, 31 Oct 2008 18:51:27 +0000 (+0100) Subject: Give Influence and Character an absolute_url. X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=ffe8bfb47649a438d1485179e68abfb5e0e17a48;p=matthijs%2Fprojects%2Fxerxes.git Give Influence and Character an absolute_url. This enabled the "view in site" button in the admin. --- diff --git a/influences/models.py b/influences/models.py index fcd1f51..198b031 100644 --- a/influences/models.py +++ b/influences/models.py @@ -1,4 +1,5 @@ from django.db import models +from django.core.urlresolvers import reverse from django.contrib.auth.models import User from django.utils.translation import ugettext_lazy as _ from threadedcomments.models import ThreadedComment @@ -18,6 +19,9 @@ class Character(models.Model): def __str__(self): return self.name + def get_absolute_url(self): + return reverse('influences_influence_detail', kwargs={'object_id' : self.pk}) + class Meta: verbose_name = _("Character") verbose_name_plural = _("Characters") @@ -44,6 +48,9 @@ class Influence(models.Model): def __str__(self): return self.summary + def get_absolute_url(self): + return reverse('influences_influence_detail', kwargs={'object_id' : self.pk}) + def get_comments(self, private): """ Gets the comments that have been made on this Influence. Each