Hi,
This is not an answer to your question (which was answered by James Bennett anyway), but I liked this recent article about class vs. function based views:
This is his conclusion:
I usually always start my views as function-based views. If I can use a generic class-based view just by overriding the attributes, I go for it. If I have some very specific needs, and it will replicate across several views, I create my own custom generic view subclassing the
django.views.generic.View
.
Regards,
A.
Antonis Christofides http://djangodeployment.com
On 04/02/2017 06:37 AM, Some Developer wrote:
Hi,
I was wondering if function based views will ever be deprecated? I absolutely hate class based views with a passion for various reasons (too complex, trying to solve a problem that doesn't exist etc). With a function based view I can write it in 2 minutes pretty much and handling multiple forms on the same page is a piece of cake. The same is not true of class based views. You need to look up which classes a certain class based view inherits from to see what methods are available, handling multiple forms on the same page is a pain in the arse if not impossible and various other things that are just way more difficult than they should be.
So yeah. Are function based views ever going to go away? I've already noticed that in Django 1.11 the login() and logout() functions are going away in favour of class based views which seems silly as I'll have to rewrite my perfectly working user app to use class based views now.
Is that a sign of things to come? If that is what the developers are planning can I please beg them to reconsider? Function based views are just fine. You might prefer class based views but there are users out there who much prefer function based views.
Please don't take this as an aggressive post. I love working with Django and I'm just passioniate about it. This isn't a flame post.
Thank you for any help :).
Some Developer.
No comments:
Post a Comment