On Mon, 2010-10-04 at 13:08 -0400, Alex Gaynor wrote:

> Last idea, I swear,

I didn't swear, so here is another slight variation :-) You actually
*call* the classmethod in your URLconf, passing any constructor
arguments to it:

url(r'^detail/author/(?P<pk>\d+)/$',
        views.AuthorDetail.as_view(some_param=123),
        name="author_detail"),

It returns a newly created view function, which in turn calls your
class.

http://bitbucket.org/spookylukey/django-class-views-experiments/src/tip/classmethod2.py

This was, in fact, suggested by Jari Pennanen in May :-(

http://groups.google.com/group/django-developers/msg/997ac5d38a96a27b

It's slightly less verbose for passing parameters, as you don't need a
separate 'configure' call.

Luke

-- 
"Doubt: In the battle between you and the world, bet on the world." 
(despair.com)

Luke Plant || http://lukeplant.me.uk/

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