Add: postseen model to user
This commit is contained in:
parent
14f9487919
commit
383b349009
2 changed files with 20 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
|||
from django.db import models
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
from apps.archive.models import PostModel
|
||||
|
||||
|
||||
class UserProfile(models.Model):
|
||||
|
@ -13,3 +14,16 @@ class UserProfile(models.Model):
|
|||
|
||||
def __str__(self):
|
||||
return self.user.username
|
||||
|
||||
|
||||
class PostSeen(models.Model):
|
||||
user = models.ForeignKey(User, on_delete=models.CASCADE)
|
||||
post_id = models.ForeignKey(PostModel, on_delete=models.CASCADE)
|
||||
date_seen = models.DateTimeField(auto_now=True)
|
||||
|
||||
class Meta:
|
||||
verbose_name = "Post Seen"
|
||||
verbose_name_plural = "Posts Seen"
|
||||
|
||||
def __str__(self):
|
||||
return str(self.user + self.post_id)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue