Mercurial > public > bravenewsurf
annotate bns_website/news/models.py @ 22:6cb0d49187ae
I added a list_filter and search_fields to the model admin for the news app. That way you can sort by date and search the title and content.
author | Bob Mourlam <bob.mourlam@gmail.com> |
---|---|
date | Mon, 31 Oct 2011 21:45:03 -0500 |
parents | 687af3cb0525 |
children | 1357c69e887d |
rev | line source |
---|---|
bob@14 | 1 from django.db import models |
bob@14 | 2 |
bob@14 | 3 # Create your models here. |
bob@14 | 4 class News(models.Model): |
bob@14 | 5 """ |
bob@14 | 6 This model represents all the info we store about each news entry. |
bob@14 | 7 |
bob@14 | 8 """ |
bob@14 | 9 title = models.CharField(max_length=128) |
bob@14 | 10 date = models.DateTimeField() |
bob@14 | 11 content = models.TextField() |
bob@14 | 12 |
bob@14 | 13 # User field? |
bob@14 | 14 |
bob@14 | 15 |
bob@14 | 16 |
bob@14 | 17 class Meta: |
bob@14 | 18 verbose_name_plural="News" |
bob@21 | 19 ordering = ['-date'] |
bob@14 | 20 |
bob@14 | 21 def __unicode__(self): |
bob@14 | 22 return self.title |