When class-based views try to handle multiple functions, they can fail. Using a switchboard view lets you isolate and modularize.
- [Instructor] Hello, everyone.…And welcome back to Building Switchboard Views,…from Mastering Django Web Development by Packt Publishing.…In this video, we're going to look more closely…at how the dispatch method works.…We're also going to learn how to combine…two or more related class-based views…into one larger switchboard view.…So, let's look at some code.…In the code files included in this course,…you should have a suplimentary/dispatch.py file.…
Let's open that up.…This file contains one class.…It's basically a stripped-down version…of the generic .view class that we've been using previously.…This class only contains two attributes.…One, http_method_names, which is just a list…of the http verbs, in all lower-case,…and the dispatch method, which accepts a request…and any number of unnamed arguments…and any number of keyword arguments.…
In previous videos, we've learned a little bit…of how to call class-based views just like functional views…through the URL's file.…We would do that simply by calling View.as_view…
- Extending class-based views
- Building a REST API
- Working with GraphQL
- Building a basic schema
- Optimizing your environment
- Working with Pipenv
- How Django handles testing
- Securing the Django admin
Skill Level Advanced
1. Advanced Class-Based Views
2. Building a REST API
Authentication with DRF6m 14s
3. GraphQL: An Alternative API
4. Optimizing Your Environment
5. Tests, Tests, Tests
6. Securing Django
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.