Websites, in general, and most commonly those with a social component, often have integrated Facebook, Twitter, and Google+ widgets to Like and Share content. In this recipe, we will guide you through the building of a similar Django app that will save information in your database whenever a user likes something. You will be able to create specific views based on the things that are liked on your website. We will similarly create a Like widget with a two-state button and badge showing the number of total likes. The following are the states:
- This is an inactive state, where you can click on a button to activate it:
![](https://static.packt-cdn.com/products/9781788837682/graphics/assets/b36c2d1a-3193-421d-addb-f85033abcbff.png)
- This is an active state, where you can click on a button to deactivate it:
![](https://static.packt-cdn.com/products/9781788837682/graphics/assets/e6cc7908-42cb-4c9f-bd3c-f0667cc8be79.png)
Changes in the state of the widget will be handled by Ajax calls.