~/talk

Generic View? What is that and why would I use it?

Talkat DjangoCon US 2019 · 2019-09-22..09-27· [python, web-platform]
slides:none on file

Explains exactly how Django implements generic class‑based views: as_view returns a function that instantiates the class, calls setup method added in Django 2.2, and dispatches to get/post methods; dispatch validates HTTP methods and calls the handler. Shows concrete generics: CreateView = set template_name + form_class, ListView supports pagination, DetailView reads the instance via pk_url_kwarg 'pk'. Includes an example repo, a working multi‑form view that later proves hard to maintain, and guidelines when to subclass or prefer simple views.

AI-written summary · about

  1. 0:00Introduction
  2. 2:14History
  3. 3:21How do we implement classbased views
  4. 4:11Example of URL with function
  5. 10:40Sample Use Case
  6. 12:08Pros Cons
  7. 14:47Generic View Internals
  8. 22:57Quick Pause
  9. 23:43Context Mixin
  10. 24:33GetContextData
  11. 26:05TemplateResponseMixin
  12. 26:17Render to Response
  13. 26:47Template View
  14. 27:28Template View Example
  15. 28:00Redirect View
  16. 28:12Rename URL
  17. 28:50List View
  18. 29:23List to List
  19. 29:39ListView
  20. 30:06GetQuerySet
  21. 30:51DetailView
  22. 31:10Object
  23. 31:48Details
  24. 32:01How it works
  25. 32:15Why it works
  26. 32:43Form View
  27. 34:14Form Handling
  28. 34:43Get Form
  29. 35:54Get Form Cards
  30. 36:19Form Valid
  31. 36:45Create View
  32. 37:31Detail View
  33. 39:32List View Demo
  34. 40:45Generic View Guidelines
  35. 41:33Overrides
  36. 41:56Classbased views
  37. 43:06Mixins
  38. 43:38Creating your own
  39. 44:18When I first started
  40. 45:19Make sure to think through
  41. 46:25Classbased view
  42. 47:13Recap
  43. 47:50Resources
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.