Update: SeenPost model
This commit is contained in:
parent
c25a259386
commit
b58d7ff749
1 changed files with 7 additions and 15 deletions
|
@ -1,12 +1,9 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
|
|
||||||
from django.db.models.signals import post_save
|
|
||||||
from django.dispatch import receiver
|
|
||||||
|
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
from sites.furaffinity.models import FA_Submission
|
from apps.sites.models import Submissions
|
||||||
|
|
||||||
class UserProfile(models.Model):
|
class UserProfile(models.Model):
|
||||||
|
|
||||||
|
@ -36,17 +33,12 @@ class UserProfile(models.Model):
|
||||||
|
|
||||||
class SeenPost(models.Model):
|
class SeenPost(models.Model):
|
||||||
user = models.ForeignKey(UserProfile, on_delete=models.CASCADE)
|
user = models.ForeignKey(UserProfile, on_delete=models.CASCADE)
|
||||||
post = models.ForeignKey(FA_Submission, on_delete=models.CASCADE)
|
post = models.ForeignKey(Submissions, on_delete=models.CASCADE)
|
||||||
timestamp = models.DateTimeField(auto_now_add=True)
|
timestamp = models.DateTimeField(auto_now_add=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
verbose_name = _("Seen Post")
|
||||||
|
verbose_name_plural = _("Seen Posts")
|
||||||
|
|
||||||
#receiver(post_save, sender=User)
|
def __str__(self) -> str:
|
||||||
#def create_user_profile(sender, instance, created, **kwargs):
|
return self.user.user.username + " - " + self.post.submission_hash
|
||||||
# if created:
|
|
||||||
# UserProfile.objects.create(user=instance)
|
|
||||||
|
|
||||||
#@receiver(post_save, sender=User)
|
|
||||||
#def save_user_profile(sender, instance, **kwargs):
|
|
||||||
# instance.user.save()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue