From 973e23815b2000e30aca0041deae1c1c64691160 Mon Sep 17 00:00:00 2001 From: Aroy-Art Date: Mon, 30 Dec 2024 23:08:07 +0100 Subject: [PATCH] Add sites Tags model --- archivist/apps/sites/models.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/archivist/apps/sites/models.py b/archivist/apps/sites/models.py index fd10f10..f7f558f 100644 --- a/archivist/apps/sites/models.py +++ b/archivist/apps/sites/models.py @@ -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)