comparison 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
comparison
equal deleted inserted replaced
44:c32897e111dc 45:2598bc18b6fb
1 """ 1 """
2 Models for the reviews application. 2 Models for the reviews application.
3 3
4 """ 4 """
5 from django.db import models 5 from django.db import models
6 6 from datetime import timedelta, datetime
7 from django.core.urlresolvers import reverse
7 8
8 class Review(models.Model): 9 class Review(models.Model):
9 """ 10 """
10 This model represents all the info we store about each review. 11 This model represents all the info we store about each review.
11 """ 12 """
20 verbose_name_plural = "Reviews" 21 verbose_name_plural = "Reviews"
21 ordering = ['-date'] 22 ordering = ['-date']
22 23
23 def __unicode__(self): 24 def __unicode__(self):
24 return self.reviewer 25 return self.reviewer
26
27 def is_new(self):
28 if datetime.now() - self.date <= timedelta(days=30):
29 return True
30 return False
31
32 def get_absolute_url(self):
33 return reverse('reviews') + '#review%d' % self.id