Mercurial > public > bravenewsurf
annotate bns_website/reviews/models.py @ 87:fbeda0f5f3be
Fix for odd Webkit CSS issue when using jPlayer Blue Monday skin and our CSS. All instances of the Future Bugler font on the Listen page were jaggie and smaller than expected.
author | Chris Ridgway <ckridgway@gmail.com> |
---|---|
date | Sun, 27 Nov 2011 15:06:26 -0600 |
parents | 2598bc18b6fb |
children |
rev | line source |
---|---|
ckridgway@16 | 1 """ |
ckridgway@16 | 2 Models for the reviews application. |
ckridgway@16 | 3 |
ckridgway@16 | 4 """ |
ckridgway@16 | 5 from django.db import models |
ckridgway@45 | 6 from datetime import timedelta, datetime |
ckridgway@45 | 7 from django.core.urlresolvers import reverse |
ckridgway@16 | 8 |
ckridgway@16 | 9 class Review(models.Model): |
ckridgway@16 | 10 """ |
ckridgway@16 | 11 This model represents all the info we store about each review. |
ckridgway@16 | 12 """ |
ckridgway@34 | 13 date = models.DateTimeField(auto_now_add=True) |
ckridgway@28 | 14 title = models.CharField(max_length=200) |
ckridgway@16 | 15 reviewer = models.CharField(max_length=200) |
ckridgway@16 | 16 review_site = models.CharField(max_length=200, blank=True) |
ckridgway@16 | 17 review_url = models.URLField(verify_exists=False, max_length=256, blank=True) |
ckridgway@16 | 18 review = models.TextField() |
ckridgway@16 | 19 |
ckridgway@16 | 20 class Meta: |
ckridgway@16 | 21 verbose_name_plural = "Reviews" |
ckridgway@28 | 22 ordering = ['-date'] |
ckridgway@16 | 23 |
ckridgway@16 | 24 def __unicode__(self): |
ckridgway@16 | 25 return self.reviewer |
ckridgway@45 | 26 |
ckridgway@45 | 27 def is_new(self): |
ckridgway@45 | 28 if datetime.now() - self.date <= timedelta(days=30): |
ckridgway@45 | 29 return True |
ckridgway@45 | 30 return False |
ckridgway@45 | 31 |
ckridgway@45 | 32 def get_absolute_url(self): |
ckridgway@45 | 33 return reverse('reviews') + '#review%d' % self.id |