On Tue, Oct 5, 2010 at 3:16 AM, Luke Plant <l.plant...@cantab.net> wrote: > 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 looks to me like it could be a winner. The fact that AuthorDetail(foo=bar).as_view(pork=spam) ignores the 'foo' argument is a minor wart, but a lot less concerning to me that the potential threading problems in copy+call, or the 'no state on self' options. Thanks for working up the examples, Luke! Russ %-) -- 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.