5 ms·
My experience has been that plain old function based views work out to be simpler and more flexible, at the cost of a little more duplication. Don't forget they
by tomlu 13y ago
My experience has been that plain old function based views work out to be simpler and more flexible, at the cost of a little more duplication. Don't forget they are an alternative too!
- erichurkman 13y agoPlus you can mix and match different view styles. If you have a lot of very similar views, elevate them to class-based views, or a smarter function-base view. If you have a lot of dissimilar views, you can keep them in function-based views while other parts of your app are using Vanilla Views or class-based views. Mix and match as appropriate (right tool, etc).
- the_cat_kittles 13y agoCompletely agree. I don't know why people opt for CBV when you can refactor out the bits of function based views that are repeated, make them a function, and then use that function in your functional views. If you refactor enough, and name your functions well, you basically have a story for each view you can read from top to bottom that tells you exactly what it does.