Generic class-based views provide a lot of functionality. Let's take a look at how you can easily extend them to create your own custom solutions.
- [Instructor] In this first section,…we'll discuss class-based views.…We'll start out by extending a generic class-based view.…Then we'll create our own mixin.…We'll build a custom class-based view,…and finally, create a switchboard style view…that combines the functionality of several views into one.…Let's talk about generic class-based views.…In section 4 of the official Django tutorial,…you learned about generic class-based views.…It's pretty amazing to see these in action.…You get a lot of functionality with a little bit of code.…As a matter of fact, in some simple apps,…you don't need any view logic at all.…
It doesn't take long to outgrow this stage.…So let's discuss how we'll us a generic view…to manage your data.…In this view, you see…that we have one generic class-based view…in uses here, AuthorUpdate,that extends the update view.…You'll see that all we have to do is associate a model…and say what fields we want,…and this update view now works.…Sometimes you wanna do a little more.…For example, you might wanna modify the context variable.…
Django is one of the world's leading web development platforms. This Python web framework makes your app building experience smoother, faster, and easier. It is a key feature behind the success of many start-ups across the world, including Instagram and Nextdoor. This course introduces next-level advanced concepts to help you build your own professional-grade Django applications.
Author Kevin Veroneau starts off by explaining how class-based views—a powerful, but often poorly understood feature—work in Django. Then learn how to create custom middleware to help organize frequently used code. Have you ever wanted to build a complete RESTful API? Find out how to do just that, starting with a basic read-only API and then adding key-based authentication to allow the full range of CRUD functionality. Plus, discover how to use model managers and the Q method to make it easier to get the data we need to our views and clients.
For the finishing touches, dive into the details of caching to improve application performance, and then add custom management commands to help automate routine tasks.
- Extending class-based views
- Creating custom class-based views
- Managing your database with middleware
- Creating template filters and tags
- Building a RESTful API
- Modeling advanced database relationships and queries
- Using a model manager for your application