Add sites Submissions model

This commit is contained in:
Aroy-Art 2024-12-30 23:10:10 +01:00
parent 6f042c3669
commit 8eee273513
Signed by: Aroy
GPG key ID: 583642324A1D2070

View file

@ -57,3 +57,39 @@ class Users(models.Model):
def get_absolute_url(self): def get_absolute_url(self):
return reverse('sites:artist_profile', args=[self.user_hash]) return reverse('sites:artist_profile', args=[self.user_hash])
class Submissions(models.Model):
submission_hash = models.CharField(unique=True, max_length=64,)
date = models.DateTimeField(null=True, editable=True)
date_added = models.DateTimeField(auto_now_add=True, editable=True)
category = models.ForeignKey(Category, on_delete=models.CASCADE, null=True)
author = models.ForeignKey(Users, on_delete=models.CASCADE, null=True)
mature = models.BooleanField(default=False)
content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE, null=True)
object_id = models.PositiveBigIntegerField(null=True)
content_object = GenericForeignKey('content_type', 'object_id')
tags = models.ManyToManyField(Tags)
custom_tags = models.ManyToManyField(CustomTags)
description_length = models.PositiveIntegerField(default=0)
class Meta:
verbose_name = _("Submission")
verbose_name_plural = _("Submissions")
indexes = [
models.Index(fields=['content_type', 'object_id']),
]
def __str__(self):
return self.submission_hash
def get_absolute_url(self):
return reverse("sites:submission", args=[self.submission_hash])