from django.db import models


class Project(models.Model):
    title = models.CharField(max_length=200, verbose_name='Titulo')
    decription = models.TextField(verbose_name='Descripción')
    image = models.ImageField(verbose_name='Imagen',
                              upload_to='projects/uploads/%Y/%m/%d/')
    link = models.URLField(null=True, blank=True, verbose_name='Sitio web')
    created = models.DateTimeField(auto_now_add=True,
                                   verbose_name='Fecha de creación')
    updated = models.DateTimeField(auto_now=True,
                                   verbose_name='Fecha de modificación')

    class Meta:
        verbose_name = 'proyecto'
        verbose_name_plural = 'proyectos'
        ordering = ["-created"]

    def __str__(self):
        return self.title
