News for hackers. Stuff that matters.
Re:Django 4.0 by bitexploder on Tuesday December 07, 2021 @11:19AM (#29474277)
Class views are fine. Even just a TemplateView saves some effort, but it comes with learning some Django magic about the life cycle of the view to load data in and out and what methods to implement. I still recommend it. You don’t have to fully embrace it and it lets you avoid repeating a lot of code.
Re:Django 4.0 by Nextgrid on Tuesday December 07, 2021 @12:20PM (#29475333)
My recommendation for learning class-based views is to use a good editor or IDE that allows you to drill down into the library code easily. In PyCharm/IntelliJ I can just command-click on the TemplateView symbol and see its implementation, and do so recursively until I've unraveled the entire thing.
Re:Django 4.0 by ChipotleRice on Tuesday December 07, 2021 @01:08PM (#29476026)
Agreed. Django's documentation is pretty light on the order in which certain functions will be executed and diving into the code is the only way I've been able to understand what happens when handling forms and views.
Re:Django 4.0 by deckiedan on Tuesday December 07, 2021 @01:17PM (#29476132)
http://ccbv.co.uk/ is a pretty useful resource for learning class based views...