view articles/models.py @ 195:214346cc0c36

Home and buy page tweaks. Add quote from Ferenc to home page. Add Paypal buy button for Ancient Winds t-shirt.
author Brian Neal <bgneal@gmail.com>
date Sat, 11 Aug 2018 14:39:23 -0500
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)})