DETAIL VIEW
The DetailView allows us to get the details of a single object, while with the Generic Display Views ListView we get the details of a list of objects. They are very comfortable because in addition to being particularly performing they are also easy to implement. Let’s go to the views.py file and implement a DetailView.
After specifying the class that inherits from DetailView, you need to specify the model and template name. As for the latter, we will use the existing articoloDetail.html. We then go to manage the class in the file urls.py.
LIST VIEW
This time we have specified a new HTML file, let’s see how we implemented it listaArticoli.html.
We also need to modify the urls.py file so that we can reach the new HTML page. Then we go to the browser at the specified address and verify that it works.
Leave A Comment