tag: function-based views

  • Creating the official Django Polls app Part 4

    Creating the official Django Polls app Part 4

    Maria D. Campbell

    This is the fourth installment in a series called Creating the official Django Polls app. Continue following this series with this fourth part. Learn how to add a minimal form to your HTML template, update a function based view, refactor urls.py to match generic views, and install djLint to format your 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

    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