DEV Community

Cover image for How to add Like/Unlike button to your Django Blog

How to add Like/Unlike button to your Django Blog

Radu-Alexandru B on October 14, 2020

In this mini-tutorial, we will add a Like/Unlike functionality to our Django Blog. As a note, we will implement this feature while using a class-ba...
Collapse
 
kaybrian profile image
kaybrian

nice this was amazing and nice. i really liked the way you brought the all concept into something else and nice to follow

Collapse
 
radualexandrub profile image
Radu-Alexandru B

Thanks!

Wish I had the time to improve on this article with newer technologies / better stack, dynamic JS (via a front-end framework) or create new content...

Collapse
 
agamerdan profile image
Merdan

Hi teacher it's awsome post thank you very much. But i give mistake when i was click like button. Field 'id' expected a number but got ''. plese help me

Collapse
 
mahfuzkhandaker profile image
MahfuzKhandaker

Awesome post. But I have a question, how it will be made ajaxify?

Collapse
 
radualexandrub profile image
Radu-Alexandru B

Yes... indeed a very good question that I currently don't have an answer to.

I had an intention to make a follow-up of this tutorial using Ajax, but I didn't make time for it... However, there are a very few tutorials on youtube on this matter, so I wish you the best if you will try to implement this feature. Unfortunately for me, I had to change my tech stack to match the jobs in my area.

Have a nice day!

Collapse
 
mahfuzkhandaker profile image
MahfuzKhandaker

Welcome. Please open the link
stackoverflow.com/questions/660922...

Collapse
 
leandropaolo1 profile image
leandropaolo1

how would you add it to BlogPostListView(ListView)?

Collapse
 
Sloan, the sloth mascot
Comment deleted
Collapse
 
labpeng profile image
lab-peng

A great tutorial!

Collapse
 
leandropaolo1 profile image
leandropaolo1

works great, good job Radu. You saved me a lot of time! Keep up the good work and good content creation

Collapse
 
enesislam profile image
enesstr

Excellent! How can I make it using AJAX? Thanks

Collapse
 
oladejo_hezekiah_1bc716c8 profile image
Oladejo Hezekiah

How about using djangorestframework to create endpoints for like functionality

Collapse
 
nareshkanigiri profile image
Naresh Kanigiri

how to create rating

Collapse
 
sanni2712 profile image
Sannihith

How to I get all the posts that a user has liked?
please tell me as soon as possible! as I have a deadline for my project.

Collapse
 
bhavdeepsaragadam profile image
Bhavdeep

Zero-argument form of "super" call is valid only within a class Pylance

Collapse
 
abelbanze profile image
Abel-Banze

Hello, I did exactly what the this tutorial show but I got this error:

Reverse for 'like_profile' with arguments '('',)' not found. 1 pattern(s) tried: ['accounts/like/(?P[0-9]+)/$']

Collapse
 
tagnev profile image
Vengat

you can log a ticket here teckiy.com/ some developers will help you out