Commit e3b6ae39 authored by luxcem's avatar luxcem

adds fields to article

parent b659d5c1
from django.core.management.base import BaseCommand
from django.contrib.auth.models import Group, Permission
groups = ["jedi", "padawan"]
permissions = {
"jedi": [],
"padawans": []
}
class Command(BaseCommand):
help = "Adds initial groups for the application (jedi and padawans)"
def handle(self, *args, **options):
...@@ -5,6 +5,13 @@ from .vote import UnDVotedMixin ...@@ -5,6 +5,13 @@ from .vote import UnDVotedMixin
from newspaper import Article as ArticleParser from newspaper import Article as ArticleParser
STATUS_CHOICES = (
("PENDING", _("Pending")),
("PUBLISHED", _("Published")),
("REJECTED", _("Rejected"))
)
class Article(UnDVotedMixin): class Article(UnDVotedMixin):
url = models.URLField("URL") url = models.URLField("URL")
lang = models.CharField(_("Language"), max_length=50, null=True) lang = models.CharField(_("Language"), max_length=50, null=True)
...@@ -19,24 +26,23 @@ class Article(UnDVotedMixin): ...@@ -19,24 +26,23 @@ class Article(UnDVotedMixin):
updated_at = models.DateTimeField(_("Last update"), auto_now=True) updated_at = models.DateTimeField(_("Last update"), auto_now=True)
published_at = models.DateTimeField(_("Publication date"), published_at = models.DateTimeField(_("Publication date"),
blank=True, null=True) blank=True, null=True)
STATUS_CHOICES = (
("PENDING", _("Pending")),
("PUBLISHED", _("Published")),
("REJECTED", _("Rejected"))
)
status = models.CharField( status = models.CharField(
_("Status"), choices=STATUS_CHOICES, _("Status"), choices=STATUS_CHOICES,
default="PENDING", max_length=20) default="PENDING", max_length=20)
tags = TaggableManager() #: priority: True if article have priority
priority = models.BooleanField(default=False)
# TODO: adds links to user tags = TaggableManager()
class Meta: class Meta:
verbose_name = _("Article") verbose_name = _("Article")
verbose_name_plural = _("Articles") verbose_name_plural = _("Articles")
permissions = (
("can_change_status", "Can change article status"),
("can_change_priority", "Can change article priority"),
("can_vote", "Can vote articles"),
)
def __str__(self): def __str__(self):
return self.title return self.title
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment