tag: function based views

Creating the official Django Polls app Part 4
Maria D. Campbell
In this section, we add a minimal form to our polls.detail.html template, update the function based vote view, create a polls/results.html template, refactor our polls/urls.py to match the new generic views, and install DJLint to format our Django templates.
#fullstack development, #macOS, #djlint, #forms, #function based views, #generic class based views, #series, #tutorial

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, create JavaScript using the fetch() method for the Like button functionality on the client side, implement history.go(0) in the JavaScript to reload the page after the Like button is clicked to update the number of likes, 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, #history.go(0)