from django.conf import settings
from django.db import models
from django.db.models.query import QuerySet
from django.utils import timezone


class VisibleQuerySet(QuerySet):

    def visible(self):
        return self.filter(is_visible=True)


class Thread(models.Model):
    title = models.CharField(max_length=100, unique=True)
    created = models.DateTimeField(default=timezone.now)
    owner = models.ForeignKey(settings.AUTH_USER_MODEL)
    # moderators = models.ManyToManyField(settings.AUTH_USER_MODEL, blank=True)
    is_open = models.BooleanField(default=True)
    is_visible = models.BooleanField(default=True)

    tags = models.ManyToManyField('Tag', blank=True)

    objects = VisibleQuerySet.as_manager()


class Message(models.Model):
    thread = models.ForeignKey('Thread', related_name='messages')
    author = models.ForeignKey(settings.AUTH_USER_MODEL)
    body = models.TextField(blank=True)
    created = models.DateTimeField(default=timezone.now)
    is_visible = models.BooleanField(default=True)

    objects = VisibleQuerySet.as_manager()


class Tag(models.Model):
    name = models.CharField(max_length=32, unique=True)

@@ -26,16 +26,61 @@
 ettings%0A
+from django.core.urlresolvers import reverse%0A
 from dja
@@ -756,24 +756,121 @@
 _manager()%0A%0A
+    def get_absolute_url(self):%0A        return reverse('thread-detail', kwargs=%7B'pk': self.pk%7D)%0A%0A
 %0Aclass Messa

Add Thread.get_absolute_url