Add sites Tags model
This commit is contained in:
parent
72b0f9f338
commit
973e23815b
1 changed files with 18 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue