comparison weblinks/models.py @ 1035:eeaf387803c6

Remove usages of @models.permalink.
author Brian Neal <bgneal@gmail.com>
date Sat, 26 Dec 2015 21:33:55 -0600
parents 3e1905e523be
children
comparison
equal deleted inserted replaced
1034:2f36abf65a62 1035:eeaf387803c6
1 """ 1 """
2 This module contains the models for the weblinks application. 2 This module contains the models for the weblinks application.
3 """ 3 """
4 import datetime 4 import datetime
5 5
6 from django.contrib.auth.models import User
7 from django.core.urlresolvers import reverse
6 from django.db import models 8 from django.db import models
7 from django.contrib.auth.models import User
8 9
9 10
10 class Category(models.Model): 11 class Category(models.Model):
11 """Links belong to categories""" 12 """Links belong to categories"""
12 title = models.CharField(max_length=64) 13 title = models.CharField(max_length=64)
66 else: 67 else:
67 self.update_date = datetime.datetime.now() 68 self.update_date = datetime.datetime.now()
68 69
69 super(Link, self).save(*args, **kwargs) 70 super(Link, self).save(*args, **kwargs)
70 71
71 @models.permalink
72 def get_absolute_url(self): 72 def get_absolute_url(self):
73 return ('weblinks-link_detail', [str(self.id)]) 73 return reverse('weblinks-link_detail', args=[str(self.pk)])
74 74
75 def search_title(self): 75 def search_title(self):
76 return self.title 76 return self.title
77 77
78 def search_summary(self): 78 def search_summary(self):