from django.db import models

# Create your models here.
class Article(models.Model):
    titre = models.CharField(max_length=100)
    auteur = models.CharField(max_length=42)
    contenu = models.TextField(null=True)
    date = models.DateTimeField(auto_now_add=True, auto_now=False,
                                verbose_name="Date de parution")
    image_couverture = models.ImageField(upload_to="images_articles/")
    image1 = models.ImageField(upload_to="images_articles/", blank=True)
    image2 = models.ImageField(upload_to="images_articles/", blank=True)
    image3 = models.ImageField(upload_to="images_articles/", blank=True)
    image4 = models.ImageField(upload_to="images_articles/", blank=True)
    image5 = models.ImageField(upload_to="images_articles/", blank=True)
    image6 = models.ImageField(upload_to="images_articles/", blank=True)
    categorie = models.ForeignKey('Categorie')

    def __str__(self):
        return self.titre


class Categorie(models.Model):
    nom = models.CharField(max_length=30)

    def __str__(self):
        return self.nom


class Prices(models.Model):
    titre = models.CharField(max_length=50)
    english_title = models.CharField(max_length=50, default="NULL")
    price = models.IntegerField(default=0)
    category = models.BooleanField(default=False)

    def __str__(self):
        return self.titre
