From 6f042c3669b7e4e555064530405afac8b52b1efe Mon Sep 17 00:00:00 2001 From: Aroy-Art Date: Mon, 30 Dec 2024 23:09:05 +0100 Subject: [PATCH] Add sites Users model --- archivist/apps/sites/models.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/archivist/apps/sites/models.py b/archivist/apps/sites/models.py index f7f558f..638c4d0 100644 --- a/archivist/apps/sites/models.py +++ b/archivist/apps/sites/models.py @@ -35,4 +35,25 @@ class Tags(models.Model): def __str__(self): return self.tag_slug + + +class Users(models.Model): + + user_hash = models.CharField(unique=True, max_length=64,) + date_added = models.DateTimeField(auto_now_add=True, editable=True) + category = models.ForeignKey(Category, on_delete=models.CASCADE, null=True) + 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 = _("user") + verbose_name_plural = _("Users") + + def __str__(self): + return self.content_object.artist + + def get_absolute_url(self): + return reverse('sites:artist_profile', args=[self.user_hash])