Ticket #5286: models.py

File models.py, 666 bytes (added by dan.fairs@…, 17 years ago)
Line 
1from django.db import models
2import datetime
3
4# Create your models here.
5class Event(models.Model):
6
7 title = models.CharField(max_length=200)
8 event_date = models.DateTimeField()
9 published_date = models.DateTimeField()
10 body = models.CharField(max_length=5000)
11
12
13 def __unicode__(self):
14 return self.title
15
16 def wasPublishedToday(self):
17 return self.date.date() == datetime.date.today()
18
19 class Admin:
20 list_display = ('title', 'published_date', 'event_date')
21 list_filter = ['published_date', 'event_date']
22 search_fields = ['title', 'body']
23 date_hierarchy = 'event_date'
Back to Top