Add sites Users model
This commit is contained in:
parent
973e23815b
commit
6f042c3669
1 changed files with 21 additions and 0 deletions
|
@ -35,4 +35,25 @@ class Tags(models.Model):
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.tag_slug
|
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)
|
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])
|
||||||
|
|
Loading…
Reference in a new issue