Mercurial > public > sg101
comparison gpp/weblinks/models.py @ 20:c0d0779b266f
Created a template tag for the latest weblinks: latest_weblinks. This necessitated adding a get_absolute_url function for the Link model along with a new view for it.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sun, 19 Apr 2009 20:41:37 +0000 |
parents | dbd703f7d63a |
children | 952e05cb3d80 |
comparison
equal
deleted
inserted
replaced
19:aa2b41c5212b | 20:c0d0779b266f |
---|---|
41 | 41 |
42 # Managers: | 42 # Managers: |
43 objects = models.Manager() | 43 objects = models.Manager() |
44 public_objects = PublicLinkManager() | 44 public_objects = PublicLinkManager() |
45 | 45 |
46 class Meta: | |
47 ordering = ('title', ) | |
48 | |
46 def __unicode__(self): | 49 def __unicode__(self): |
47 return self.title | 50 return self.title |
48 | 51 |
49 class Meta: | 52 @models.permalink |
50 ordering = ('title', ) | 53 def get_absolute_url(self): |
54 return ('weblinks-link_detail', [str(self.id)]) | |
51 | 55 |
52 | 56 |
53 class FlaggedLinkManager(models.Manager): | 57 class FlaggedLinkManager(models.Manager): |
54 | 58 |
55 def create(self, link, user): | 59 def create(self, link, user): |