Mercurial > public > madeira
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/articles/models.py Sat Apr 14 16:40:29 2012 -0500 @@ -0,0 +1,28 @@ +""" +Models for the articles application. + +""" +from django.db import models + + +class Article(models.Model): + title = models.CharField(max_length=64) + date = models.DateTimeField(db_index=True) + text = models.TextField() + source = models.TextField(help_text="Enter the source/author for the " + "article, copyright info, etc; it will appear under the article.") + url = models.URLField(blank=True, + help_text = 'Link to original article; optional') + pdf = models.FileField(upload_to = 'pdf/articles/%Y/%m/%d/', blank=True, + help_text="If you want to make the original article available as " + "a PDF download, you may upload it here.") + + def __unicode__(self): + return self.title + + class Meta: + ordering = ['-date'] + + @models.permalink + def get_absolute_url(self): + return ('articles-item', [], {'pk': str(self.id)})