from django.db import models
from django.urls import reverse


class Article(models.Model):
    title = models.CharField(max_length=110)
    image = models.ImageField()
    text = models.TextField()
    created = models.DateTimeField(auto_now_add=True)
    updated = models.DateField(auto_now=True)
    is_show = models.BooleanField(default=False)
    
    def __str__(self):
        return f"Article:{self.title}"
    
    
    def get_absolute_url(self):
        return reverse('blog:article_detail', args=[self.id])
        
    
    
    
