Mercurial > public > sg101
comparison news/models.py @ 1002:28d68f97cb26
Don't use models.permalink.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Thu, 26 Nov 2015 00:47:33 -0600 |
parents | c6c3ba5cf6eb |
children | 9fc12bbc8c81 |
comparison
equal
deleted
inserted
replaced
1001:c6c3ba5cf6eb | 1002:28d68f97cb26 |
---|---|
1 """ | 1 """ |
2 Models for the news application. | 2 Models for the news application. |
3 """ | 3 """ |
4 import datetime | 4 import datetime |
5 | 5 |
6 from django.core.urlresolvers import reverse | |
6 from django.db import models | 7 from django.db import models |
7 from django.contrib.auth.models import User | 8 from django.contrib.auth.models import User |
8 from tagging.fields import TagField | 9 from tagging.fields import TagField |
9 | 10 |
10 from core.markup import site_markup | 11 from core.markup import site_markup |
95 forums_topic = models.OneToOneField('forums.Topic', blank=True, null=True, | 96 forums_topic = models.OneToOneField('forums.Topic', blank=True, null=True, |
96 on_delete=models.SET_NULL, | 97 on_delete=models.SET_NULL, |
97 db_index=False, | 98 db_index=False, |
98 help_text="Forum topic used for comments") | 99 help_text="Forum topic used for comments") |
99 | 100 |
100 @models.permalink | |
101 def get_absolute_url(self): | 101 def get_absolute_url(self): |
102 return ('news.views.story', [str(self.id)]) | 102 return reverse('news-story', args=[str(self.id)]) |
103 | 103 |
104 def __unicode__(self): | 104 def __unicode__(self): |
105 return self.title | 105 return self.title |
106 | 106 |
107 class Meta: | 107 class Meta: |