Detailview updating mean comments online dating
Here we'll learn about generic class-based views, and show how they can reduce the amount of code you have to write for common use cases.We'll also go into URL handling in greater detail, showing how to perform basic pattern matching.
This does all the work of creating an instance of the class, and making sure that the right handler methods are called for incoming HTTP requests.
We could quite easily write the book list view as a regular function (just like our previous index view), which would query the database for all books, and then call ) — a class that inherits from an existing view.
Because the generic view already implements most of the functionality we need, and follows Django best-practice, we will be able to create a more robust list view with less code, less repetition, and ultimately less maintenance.
For these pages we're going to demonstrate a completely different type of view: generic class-based list and detail views.
These can significantly reduce the amount of view code needed, making them easier to write and maintain.
It is expecting a really basic form element but you've added in a couple extra things like the action attribute and a submit button, which the challenge doesn't seem to like.