Category : django-generic-relations

I’m trying to add a like/dislike functionality in Django using generic relationships. Can someone help me? My post model class Post(models.Model): title = models.CharField(max_length=225) post_image = models.ImageField(null=True, blank=True, upload_to="images/") author = models.ForeignKey(User, on_delete=models.CASCADE) body = models.TextField() post_date = models.DateTimeField(auto_now_add=True) def __str__(self): return self.title + ‘ | ‘ + str(self.author) class Meta: ordering = [‘-post_date’,] def ..

Read more