Add sites Tags model

This commit is contained in:
Aroy-Art 2024-12-30 23:08:07 +01:00
parent 72b0f9f338
commit 973e23815b
Signed by: Aroy
GPG key ID: 583642324A1D2070

View file

@ -18,3 +18,21 @@ class Category(models.Model):
def __str__(self):
return self.name.capitalize()
class Tags(models.Model):
tag_slug = models.CharField(unique=True, max_length=64,)
date_added = models.DateTimeField(auto_now_add=True, editable=True)
category = models.ManyToManyField(Category)
content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE, null=True)
object_id = models.PositiveBigIntegerField(null=True)
content_object = GenericForeignKey('content_type', 'object_id')
class Meta:
verbose_name = _("Tag")
verbose_name_plural = _("Tags")
def __str__(self):
return self.tag_slug
content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE, null=True)