--
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...@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.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAGyPVTuyqCA-DTY9%3D%2BhO6DaWRSTt8ooz%2BKnFKrbXuqF4tUyKkQ%40mail.gmail.com.
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
--
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...@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/e8af988b-3fd2-f781-e33b-00fa9b2b205f%40googlemail.com.
Try doing something that a class based view doesn't support out of the box and then you'll understand why function based views are still used. Even something as simple as returning some JSON means you have to dig into how a class based view works where as it is about 3 lines of code in a function based view.
Then what about a view that has to handle 2 (or more) different form classes on the same page? You'll soon find that having to do that in a class based view means major work rewriting or building your own class based view.
As I said I'll give them another go but I've yet to be convinced of their greatness.
On 03/04/2017 15:54, Andréas Kühne wrote:
I find it interesting that so many haven't embraced the new CBV's. I
ONLY use CBV's when designing and find the usages much simpler - because
of no boilerplate and also the fact that I can derive from other classes
when needed.
Of course - the first time you use a form view or a template view and
you find yourself having problems - debugging that could take a while,
however, once you have done that I really haven't seen this as an issue.
Also because most of the default views inherit from the same mixins -
once you have understood how one works - you usually get the hang of it.
It could be that the first thing I did in django was to refactor views
from function based to class based - and therefore haven't started
exploring FBV's more :-)
Just my 2 cents...
Regards,
Andréas
2017-04-03 13:52 GMT+02:00 Some Developer <someukd...@gmail.com
<mailto:someukdeveloper@gmail.com>>:
--
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...@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/7d612ef6-4438-70ab-9aea-d5595af22e5a%40googlemail.com.
--
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...@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/30a5eab2-dee9-eaff-66e4-105ba85bf0bf%40googlemail.com.
--
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...@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/BD0905CB-9D16-4F9A-8CBD-7115B3E46303%40andrewsforge.com.