Implementing the Like widget

Nowadays, social websites usually have integrated Facebook, Twitter, and Google+ widgets to like and share pages. In this recipe, I will guide you through a similar internal liking Django app that saves all the likes in your database so that you can create specific views based on the things that are liked on your website. We will create a Like widget with a two-state button and badge showing the number of total likes. The following are the states:

  • Inactive state, where you can click on a button to activate it:
    Implementing the Like widget
  • Active state, where you can click on a button to deactivate it:

The state of the widget will be handled by Ajax ...

Get Django: Web Development with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.