adding
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
from django.db import models
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
|
||||
class Article(models.Model):
|
||||
"""مقالهی لندینگپیج — از پنل ادمین مدیریت میشود و در «/articles/» سرو
|
||||
میشود (بهجای فایلهای HTML استاتیک قبلی)."""
|
||||
|
||||
slug = models.SlugField(unique=True, max_length=120, verbose_name=_("نامک (slug)"))
|
||||
title = models.CharField(max_length=200, verbose_name=_("عنوان"))
|
||||
meta_description = models.CharField(
|
||||
max_length=300, blank=True, verbose_name=_("توضیح متا (SEO)"),
|
||||
help_text=_("در تگهای meta description و og:description استفاده میشود."),
|
||||
)
|
||||
excerpt = models.CharField(
|
||||
max_length=300, verbose_name=_("خلاصه"),
|
||||
help_text=_("همان متن کوتاهی که زیر عنوان در لیست مقالات نشان داده میشود."),
|
||||
)
|
||||
content_html = models.TextField(
|
||||
verbose_name=_("محتوا (HTML)"),
|
||||
help_text=_("محتوای مقاله با تگهای HTML ساده مثل <p>، <h2>، <strong>."),
|
||||
)
|
||||
read_minutes = models.PositiveSmallIntegerField(default=3, verbose_name=_("زمان مطالعه (دقیقه)"))
|
||||
is_published = models.BooleanField(default=True, verbose_name=_("منتشرشده"))
|
||||
published_at = models.DateField(verbose_name=_("تاریخ انتشار"))
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
updated_at = models.DateTimeField(auto_now=True)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _("مقاله")
|
||||
verbose_name_plural = _("مقالات")
|
||||
ordering = ("-published_at", "-created_at")
|
||||
|
||||
def __str__(self):
|
||||
return self.title
|
||||
Reference in New Issue
Block a user