article.py 962 Bytes
Newer Older
cynddl's avatar
cynddl committed
1
from django.db import models
cynddl's avatar
cynddl committed
2 3
from django.utils.translation import ugettext_lazy as _
from taggit.managers import TaggableManager
4
from .vote import UnDVotedMixin
cynddl's avatar
cynddl committed
5

cynddl's avatar
cynddl committed
6

7
class Article(UnDVotedMixin):
cynddl's avatar
cynddl committed
8 9 10 11 12 13 14 15 16 17 18 19 20
    url = models.URLField("URL")
    lang = models.CharField(_("Language"), max_length=50)
    metadata = models.TextField(_("Opengraph metadata"))
    screenshot = models.ImageField(_("Article screenshot"))
    title = models.CharField(_("Article title"), max_length=255)
    extracts = models.TextField(_("Content extracts"))

    published_at = models.DateTimeField(_("Publication date"))
    created_at = models.DateTimeField(_("Creation date"), auto_now_add=True)
    updated_at = models.DateTimeField(_("Last update"), auto_now=True)
    published = models.BooleanField(_("Published"))

    tags = TaggableManager()
21 22 23 24

    class Meta:
        verbose_name = _("Article")
        verbose_name_plural = _("Articles")
luxcem's avatar
luxcem committed
25 26 27

    def __str__(self):
        return self.title