So it works as

> url(r'^location/$', WouldLoveToHaveClassBasedView.as_view(), 
> name='name_for_convenience')

Didn't realize I could just pass the class object.  Makes sense.
Guess I'm getting old and change fearing.

I think the only thing that's bugging me is that you have to include
the whole views.py in your url conf.  Just feels less graceful than
having the dispatcher nab what it needs on demand.  I'll get over it.

Unless someone has a better idea!

On Dec 3, 3:12 pm, Daniel Roseman <dan...@roseman.org.uk> wrote:
> On Dec 3, 8:47 pm, Andrew Willey <and...@apt9online.com> wrote:
>
> > Forgot to in mention the actual question from the subject.
>
> > Is there a "blessed" way to use class-based views with named urls in
> > the
>
> > > url(r'^location/$', view='WouldLoveToHaveClassBasedView.as_view', 
> > > name='name_for_convenience')
>
> I don't understand what one thing has got to do with the other. You
> can still use a named URL even if you use the object rather than a
> string to refer to it:
>
>     url(r'^location/$', view=WouldLoveToHaveClassBasedView.as_view(),
> name='name_for_convenience')
>
> It's the `url` function that allows you to use the name kwarg, not
> anything to do with the view function that's being called.
> --
> DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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