Mercurial > public > madeira
view articles/models.py @ 130:3062c547bb90
For Django 1.6: new test discovery plus reverse now does urlquote().
My base64 keys were padded with '=' and these got quoted when doing
a reverse to generate the URL. So changed the test to look for a
quoted version of the key. This will change the URLs sent to users, but
I believe it will all be taken care of by Django.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Tue, 24 Dec 2013 16:47:27 -0600 |
parents | e2868ad47a1e |
children |
line wrap: on
line source
""" 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)})