I have been using class views at work that are based off of Jacob's
base GenericView class since last summer.

http://github.com/fitzgen/class_views/blob/master/views.py

Things that people haven't really mentioned, but need addressing, that
we had to find solutions for:

* How to do redirects in class based views? See lines 71-86 and 166.

* How to decorate the __call__ method without doing a pointless
override of __call__ that just calls super so that you have something
to @decorate on top of. Check out the meta class on line 175. This
allows you to specify 'decorators = [login_required,
permission_required("polls.can_vote")]' on your subclass. I showed
this to Jacob at DjangoSki, and he seemed positive.

* How to decorate methods, when the decorator expects the first
argument to be request, and not self. See line 8. Ideally though,
Django's decorators would handle this, rather than forcing the use of
decorate_method_with on to the end users.

* How to deal with state and self. I have written an instantiator that
wraps the view class and instantiates a new instance of the class for
every request so that everything is thread safe. This works, but
agian, it would be nice if Django checked to see if the callable being
linked to a url route is a class, in which case it would handle the
instantiation of a new instance for every request. See line 188.

Excited to get this stuff in to 1.3!

_Nick_

On May 12, 1:16 pm, Ben Firshman <b...@firshman.co.uk> wrote:
> On 11 May 2010, at 01:37, Russell Keith-Magee wrote:
>
>
>
> > Are class-based views planned for 1.3? Well, we haven't done any
> > formal planning for 1.3 yet, but I'm going to guess that the 1.3 high
> > priority feature list will essentially be "the features that got
> > dropped from 1.2", so in all likelihood, yes. However, that doesn't
> > mean that they will definitely be in 1.3 - someone still needs to do
> > the implementation. If you really want class based generic views, be
> > like Ben and make it happen -- show us the code!.
>
> Oooh, class-based views.
>
> This is something I've been thinking about a lot, and I'll probably dive into 
> it at the Djangocon.eu sprints. Feel free to make a start Jari. ;)
>
> Ben
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django developers" group.
> To post to this group, send email to django-develop...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-developers+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/django-developers?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-develop...@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to