Mercurial > public > bravenewsurf
diff bns_website/reviews/models.py @ 45:2598bc18b6fb
Shamelessly stole Bob's anchor target method. Fixed CSS for reviews so that the top of the review is not clipped by the navbar.
author | Chris Ridgway <ckridgway@gmail.com> |
---|---|
date | Wed, 09 Nov 2011 23:18:32 -0600 |
parents | 37d9b6b1a097 |
children |
line wrap: on
line diff
--- a/bns_website/reviews/models.py Mon Nov 07 21:22:56 2011 -0600 +++ b/bns_website/reviews/models.py Wed Nov 09 23:18:32 2011 -0600 @@ -3,7 +3,8 @@ """ from django.db import models - +from datetime import timedelta, datetime +from django.core.urlresolvers import reverse class Review(models.Model): """ @@ -22,3 +23,11 @@ def __unicode__(self): return self.reviewer + + def is_new(self): + if datetime.now() - self.date <= timedelta(days=30): + return True + return False + + def get_absolute_url(self): + return reverse('reviews') + '#review%d' % self.id