tag: fetch api

How to create a fullstack application using Django and Python Part 28
Maria D. Campbell
In this section, I add a like button to the post_detail.html template. I add a likes field to my Post model, create a function-based like_post view in boards/views.py, and create JavaScript using the fetch() method for the Like button functionality on the client side. I implement history.go(0) in the JavaScript to reload the page after the Like button is clicked to update the number of likes. I also create a like URL in boards/urls.py, and add post.likes to templates/post_detail.html.
#fullstack development, #macOS, #django, #python3, #fetch api, #manytomany, #function-based views, #jsonresponse