I would like to implement a simple 'like' button. No need for user authentication etc, I prefer to be simple, on click +1 like. Any ideas on how to implement this like btn? I appreciate your help!
models.py
class Mainnews(models.Model):
author = models.ForeignKey(Author, on_delete=models.DO_NOTHING, default= True)
title = models.CharField(max_length=200)
description = models.TextField()
image = models.ImageField(upload_to = 'photos/%Y/%m/%d/')
is_published = models.BooleanField(default = True)
publish_date = models.DateTimeField(default = datetime.now, blank = True)
views_counter = models.IntegerField(default=0)
likes = models.IntegerField(default=0)
def number_of_likes(self):
return self.likes.count()
def __str__(self):
return self.title
question from:https://stackoverflow.com/questions/65877625/django-how-to-implement-public-like-button