Creating Django's list views

We briefly considered the creation of a Django view in Chapter 8, Integrating Django in PyCharm. However, there are a number of different options when it comes to designing a view for your applications. In this subsection, we will implement an aggregated view for multiple blog posts (a list view) so that users of the application can see and iterate through all the available blog posts in our Django project.

As we have learned, a Django view is defined as a function that takes in a web request and returns some form of response. The logic within the function specifies the data included in the response, as well as how it might be structured. First, let's create that list view:

  1. Open the blog/views.py file and edit ...

Get Hands-On Application Development with PyCharm 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.