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.

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.

 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.

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 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

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.

Reply via email to