On Fri, Sep 14, 2012 at 12:12 AM, Russell Keith-Magee < russ...@keith-magee.com> wrote:
> On Thu, Sep 13, 2012 at 12:58 AM, Cal Leeming [Simplicity Media Ltd] > <cal.leem...@simplicitymedialtd.co.uk> wrote: > > Hi all, > > > > There is a lot of debate on whether there is a real future for the Django > > CBVs (class based views). > > Sigh. Thank you for the detailed response on this - hopefully this thread will serve as a reference point for people in the future > > No - there isn't *any* debate about the future of CBVs. There *are* a > lot of people who apparently don't like them who keep making a lot of > noise. Every single time I've spoken with one of those people at > length, the problem has reduced to either: > > 1) I don't like classes/OO. There's no winning these people over. Well that's certainly not the reason I dislike them - OO makes views tidier, simple. > 2) CBV's aren't documented well. You won't get any argument from me > on (2). I'll take the hit for that -- the initial documentation for > CBVs was my doing, and it has lots of room for improvement. +1 > I'm not aware of anyone in the core that has advocated removing > class-based views from Django. > > Personally, I find them tedious, and just wanted a > > way to keep my views clean. > > > > So, here is a really minimalistic way of having class based views, > without > > the fuss. > > > > http://djangosnippets.org/snippets/2814/ > > > > This is a fork from: > > > > http://stackoverflow.com/questions/742/class-views-in-django > > http://djangosnippets.org/snippets/2041/ > > > > My thanks to eallik for his initial post on stackoverflow for this. > > > > Personally I think Django's CBVs should offer a really minimalistic base > > like this, as well as the existing CBV stuff already in the core - so as > to > > not force people into needing to learn an entirely new way of doing > things, > > but at the same time allowing them to reap some of the benefits of using > > callable classes as views. > > > > Any thoughts? > > What you've described -- a single entry point class-based view base > class -- *does* exist. It's called django.views.generic.View. Override > the "dispatch" method, or write a "get/post/put/etc" method, and > you've got a class-based view. > I noticed this yesterday whilst trawling through the documentation again, so I will look at this again. > > I also think you should read the discussions that led to the current > form of Class-based views. The pattern you've proposed from Stack > Overflow was one of many suggestions that were made, and were rejected > because of inherent problems with the approach. The discussions are > summarised in the wiki: > > https://code.djangoproject.com/wiki/ClassBasedViews Thanks for sending this link through, looks very detailed, I will spend an hour or two reading through it all and put some thoughts back. > > > Yours, > Russ Magee %-) > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.