4 ms·
I'd agree that CBV's can be difficult to reason with (though I personally still use them for most views) but the following two websites have massively helped me
by adamckay 3y ago
I'd agree that CBV's can be difficult to reason with (though I personally still use them for most views) but the following two websites have massively helped me make sense of them. The only thing missing really is the actual flow of a request, such as knowing `dispatch() -> get() -> get_context_data()` but it's not terribly difficult to work out and learn.
https://ccbv.co.uk/ https://ccbv.co.uk/
https://www.cdrf.co/ https://www.cdrf.co/
- Nextgrid 3y agoFor anyone struggling with remembering class based view mixins, I suggest you get yourself a proper IDE that allows you to trivially look into the implementation of anything as well as lookup any symbol with fuzzy search. PyCharm/IntelliJ is one. Since using such an IDE I pretty much never have to rely on the documentation because it’s much easier to Cmd+click into a symbol and look at its implementation.
- kodah 3y agoProperly configured VSCode with the Python Virtual Environment Manager plugin also makes this easy.
- darkteflon 3y agoIs “Python Virtual Environment Manager” a third party plugin? I had a search but could turn nothing up. Wondering if I’m missing out.
- daydream 3y agoThey probably mean this one: https://marketplace.visualstudio.com/items?itemName=donjayamanne.python-environment-manager https://marketplace.visualstudio.com/items?itemName=donjayam...
- nouveaux 3y agoThe problem with relying on fancy IDE to untangle your classes is that it breaks on GitHub. Also it's harder to discuss snippets of code asynchronously. People like to think CBV offer a lot of free things but they miss the trade off. CBV makes it easier to write code but harder to read the code. CBV should only be used for the simplest of cases IMO.
- code_biologist 3y agoI came here to post that first link. I don't mind working with CBVs if that's the existing style in a project, but the very existence of CCBV highlights the pain of lots of indirection. Certainly a lot of power, but not trivial to remember how everything connects either.