models.ManyToManyField(CustomUser, verbose_name='likes’, related_name='article_post') def like_post(request, post_id): post = ArticlePost.objects.get(pk=post_id) user = request.user if user in post.likes.all(): post.likes.remove(user) post.likes_count -= 1 else: post.likes.add(user) post.likes_count += 1