Skip to content

Commit

Permalink
ft:like model -- add model fields
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianMwevi committed Jun 16, 2022
1 parent 503cdb0 commit 8565aaf
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions posts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
from django.contrib.auth.models import User
from neighborhoods.models import Neighborhood

# Create your models here.


class Post(models.Model):
user = models.ForeignKey(
Expand Down Expand Up @@ -34,3 +32,13 @@ class Comment(models.Model):
def __str__(self):
return self.comment


class Like(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
post = models.ForeignKey(
Post, on_delete=models.CASCADE, blank=True, null=True)
comment = models.ForeignKey(
Comment, on_delete=models.CASCADE, blank=True, null=True)

created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)

0 comments on commit 8565aaf

Please sign in to comment.