On Tuesday, January 12, 2021 at 7:21:33 AM UTC-8 David Nugent wrote:
Robert,
I think the ultimate resource you can use on this beyond the documentation is the django source code itself.
It may look confusing at first, but if you check out the class hierarchy from the starting points in the docs, how classes are related and mix-ins are used, you gain a lot of insight you don't and can't get from the docs. With that understanding you are able to author with your own CBVs derived from the bits provided by Django to create a great deal of customisation for you applications where the stock ones may not fit.
There is no better teacher than trying things yourself, working out what went wrong when it does not work.
But I'll provide a nutshell version:
Essentially a CBV is a class that provides functionality around dispatching a web request. At the core is thedispatch() method, which passes the request onto specific method handlers. Anything else beyond that supports more specific use cases that usually simplifies handling the request - i.e. templates - and each of those provides its own set of patterns.HTH,
/dAre there any Django libraries that make extensive use of class-based views that I might study if I want to gain an in-depth understanding of how to use them? The Django documentation is OK at explaining what they are and how they work but most of the examples are very trivial in nature. I'd like to become a "power user" and for that I need lots of code to study. I've looked at the Classy Class-Based Views examples but they seem too "meta" to me to shed any real light on how to use them in practice. Thanks.
--You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/eda0feed-fb61-4882-bbc3-14531b13526fn%40googlegroups.com.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/41a1019d-3da5-40cc-9abe-5b69d77cc542n%40googlegroups.com.
No comments:
Post a Comment