from django.db import models
from django.utils import timezone

# Create your models here.

class Content(models.Model):
    CONTENT_TYPE_CHOICES = [
        ('article', 'مقاله'),
        ('news', 'خبر'),
    ]

    title = models.CharField(max_length=200)
    image = models.CharField(max_length=255)
    body = models.TextField()
    content_type = models.CharField(max_length=10, choices=CONTENT_TYPE_CHOICES)
    published_date = models.DateTimeField(default=timezone.now)

    def __str__(self):
        return f"{self.title} ({self.get_content_type_display()})"