Add: postseen model to user

This commit is contained in:
Aroy-Art 2025-04-17 21:47:45 +02:00
parent 14f9487919
commit 383b349009
Signed by: Aroy
GPG key ID: 583642324A1D2070
2 changed files with 20 additions and 1 deletions

View file

@ -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)