Mercurial > public > bravenewsurf
annotate bns_website/news/models.py @ 51:6c7467599fa9
I added the jquery plugin jplayer to use for playing samples of the album. For now I just used some of the songs linked to by the jplayer demo, but I also picked a couple songs at random from my iTunes library. Rather than add them to the repository I just named them 1.mp3, 1.m4a, 1.ogg and 2.mp3, 2.m4a, 2.ogg and anybody that wants to test the player will have to add some random songs themselves.
I only added the "blue monday" player skin because I personally think it looks the best of the examples they supply, but we could change that or roll our own if needed.
author | Bob Mourlam <bob.mourlam@gmail.com> |
---|---|
date | Sun, 13 Nov 2011 17:01:36 -0600 |
parents | 9ce9f77d6cde |
children |
rev | line source |
---|---|
bob@14 | 1 from django.db import models |
bob@23 | 2 from datetime import timedelta, datetime |
bob@41 | 3 from django.core.urlresolvers import reverse |
bob@14 | 4 |
bob@14 | 5 # Create your models here. |
bob@14 | 6 class News(models.Model): |
bob@14 | 7 """ |
bob@14 | 8 This model represents all the info we store about each news entry. |
bob@14 | 9 |
bob@14 | 10 """ |
bob@14 | 11 title = models.CharField(max_length=128) |
bob@14 | 12 date = models.DateTimeField() |
bob@14 | 13 content = models.TextField() |
bob@14 | 14 |
bob@41 | 15 def __unicode__(self): |
bob@41 | 16 return self.title |
bob@14 | 17 |
bob@23 | 18 def is_new(self): |
bob@37 | 19 if datetime.now() - self.date <= timedelta(days=30): |
bob@23 | 20 return True |
bob@23 | 21 return False |
bob@23 | 22 |
bob@41 | 23 def get_absolute_url(self): |
bob@41 | 24 return reverse('news') + '#news%d' % self.id |
bob@14 | 25 |
bob@14 | 26 class Meta: |
bob@14 | 27 verbose_name_plural="News" |
bob@21 | 28 ordering = ['-date'] |