Saturday, April 1, 2017

Re: Will function based views ever be deprecated?

If you're asking "Will there ever be a point when all built-in views in Django are class-based", the answer is "maybe", because whether to write one of those class-based or function-based depends on what the view needs to do, how much configurability/extensibility it needs to support, etc.

If you're asking "Will there ever be a point when Django no longer supports using functions as views, period", the answer is almost certainly "no".

Officially, the definition of a Django view is a Python callable which takes an HttpRequest object as its first positional argument, and which either returns an HttpResponse object or raises an exception. That definition is unlikely to change.


On Sat, Apr 1, 2017 at 9:48 PM, George Silva <georger.silva@gmail.com> wrote:
In the end, cbvs are functions. So no, I don't they come to an end soon.

I love function based views.

Em 2 de abr de 2017 12:37 AM, "Some Developer" <someukdeveloper@gmail.com> escreveu:
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.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a604368c-0b58-840b-3143-5425e6b73b5a%40googlemail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAGyPVTuyqCA-DTY9%3D%2BhO6DaWRSTt8ooz%2BKnFKrbXuqF4tUyKkQ%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAL13Cg9MqtbsfivDjuQJwee%2BnvdBx3BXOn4wDqnUbEqV1Bhh-w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment