# Path: apps/images/models/abstracts.py
# class ImageAbstractModel(models.Model):
#     file = models.ImageField(upload_to=upload_dir)
#     width = models.IntegerField(default=0, editable=False)
#     height = models.IntegerField(default=0, editable=False)
# 
#     # Content-object field
#     content_type = models.ForeignKey(
#         ContentType, on_delete=models.CASCADE, null=True
#     )
#     object_id = models.PositiveIntegerField(db_index=True, null=True)
#     content_object = GenericForeignKey("content_type", "object_id")
# 
#     uploaded_at = models.DateTimeField(default=timezone.now)
# 
#     class Meta:
#         abstract = True
#         verbose_name = _("image")
#         verbose_name_plural = _("image")
#         ordering = ["-uploaded_at"]


from django.conf import settings
from django.db import models
from django.utils.functional import cached_property
from .abstracts import ImageAbstractModel


debug = getattr(settings, "DEBUG", True)


class Image(ImageAbstractModel):
    description = models.CharField(max_length=255, blank=True)
    is_cover = models.BooleanField(default=False)

    def __str__(self):
        return self.description


# Path: apps/images/models/abstracts.py
# class ImageAbstractModel(models.Model):
#     file = models.ImageField(upload_to=upload_dir)
#     width = models.IntegerField(default=0, editable=False)
#     height = models.IntegerField(default=0, editable=False)
# 
#     # Content-object field
#     content_type = models.ForeignKey(
#         ContentType, on_delete=models.CASCADE, null=True
#     )
#     object_id = models.PositiveIntegerField(db_index=True, null=True)
#     content_object = GenericForeignKey("content_type", "object_id")
# 
#     uploaded_at = models.DateTimeField(default=timezone.now)
# 
#     class Meta:
#         abstract = True
#         verbose_name = _("image")
#         verbose_name_plural = _("image")
#         ordering = ["-uploaded_at"]


# Path: apps/images/models/db.py
from django.conf import settings
from django.db import models
from django.utils.functional import cached_property
from .abstracts import ImageAbstractModel



debug = getattr(settings, "DEBUG", True)


class Image(ImageAbstractModel):
    description = models.CharField(max_length=255, blank=True)
    is_cover = models.BooleanField(default=False)

    def __str__(self):
        return self.description


    class Meta(ImageAbstractModel.Meta):