posts are done

This commit is contained in:
2026-05-19 00:08:02 +02:00
parent 202ce22102
commit 2e9e3ed41b
35 changed files with 1528 additions and 272 deletions

View File

@@ -82,6 +82,18 @@ class PostContent(SoftDeleteModel):
return super().save(*args, **kwargs)
class PostSave(models.Model):
post = models.ForeignKey(Post, on_delete=models.CASCADE, related_name='saves')
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name='saved_posts')
created_at = models.DateTimeField(auto_now_add=True)
class Meta:
unique_together = ('post', 'user')
def __str__(self):
return f"{self.user} saved Post {self.post_id}"
class PostVote(SoftDeleteModel):
class VoteChoice(models.IntegerChoices):
UP = 1, 'Upvote'