comparison articles/models.py @ 71:e2868ad47a1e

For Django 1.4, using the new manage.py.
author Brian Neal <bgneal@gmail.com>
date Sat, 14 Apr 2012 16:40:29 -0500
parents madeira/articles/models.py@e17fc6bbb9b0
children
comparison
equal deleted inserted replaced
70:f26cdda0ad8b 71:e2868ad47a1e
1 """
2 Models for the articles application.
3
4 """
5 from django.db import models
6
7
8 class Article(models.Model):
9 title = models.CharField(max_length=64)
10 date = models.DateTimeField(db_index=True)
11 text = models.TextField()
12 source = models.TextField(help_text="Enter the source/author for the "
13 "article, copyright info, etc; it will appear under the article.")
14 url = models.URLField(blank=True,
15 help_text = 'Link to original article; optional')
16 pdf = models.FileField(upload_to = 'pdf/articles/%Y/%m/%d/', blank=True,
17 help_text="If you want to make the original article available as "
18 "a PDF download, you may upload it here.")
19
20 def __unicode__(self):
21 return self.title
22
23 class Meta:
24 ordering = ['-date']
25
26 @models.permalink
27 def get_absolute_url(self):
28 return ('articles-item', [], {'pk': str(self.id)})