articles/2025/django-views/ #36
Replies: 5 comments 3 replies
-
|
Nice article, thanks for sharing. |
Beta Was this translation helpful? Give feedback.
-
|
Interesting idea, and I'm trying this approach now in one of my hobby projects. One request for the implementation examples: also add the import paths for the Django requirements, like |
Beta Was this translation helpful? Give feedback.
-
|
A funny article. The author doesn't want to remember other “magic” methods and still uses magic such as get_object_or_404, redirect, or something else. The author's approach shows that he probably does not understand an important idea of GCBV: the declarative way. A declarative way means less testing. I agree with this article if the author earns money based on the number of lines of code. In this case, Black-formatter can also help to get many more lines. |
Beta Was this translation helpful? Give feedback.
-
|
I have the exact same approach. Having the One question: put of curitosity, why you return |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for sharing! As you have recommended, I have replaced generic CBVs with the base View class in a Django/Alpine Ajax project, and find that it is immediately clearer what I need to code to implement the logic. I use my time and effort more productively to implement features rather than trying to understand how the CBV classes hang together. The downside is more lines of code, but that is an acceptable price to pay. I suspect I will continue to use the generic CBVs to implement simple and straight-forward view logic, but I now have a better approach to implementing custom view logic when that is required. Thanks once again! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
articles/2025/django-views/
Why I only use Django's base View class instead of generic class-based views or function-based views.
https://www.loopwerk.io/articles/2025/django-views/?utm_campaign=Django%2BNewsletter&utm_medium=email&utm_source=Django_Newsletter_300
Beta Was this translation helpful? Give feedback.
All reactions