Re: Migrating to class-based views and django.core.urlresolvers.reverse

2010-12-07 Thread Sean Brant
Again this topic is now in django-user land. I do this in views.py if want the decorator on all methods (get|post). myview = login_required(MyView.as_view()) On Dec 7, 2010, at 1:10 PM, Daniel Swarbrick wrote: > That is indeed in the docs, and I have seen that. What eludes me is > how to us

Re: Migrating to class-based views and django.core.urlresolvers.reverse

2010-12-07 Thread Daniel Swarbrick
That is indeed in the docs, and I have seen that. What eludes me is how to use decorators more complex than login_required() from within urls.py. For example, this works fine: from django.contrib.auth.decorators import user_passes_test from django.utils.decorators import method_decorator from dja

Re: Migrating to class-based views and django.core.urlresolvers.reverse

2010-12-07 Thread Ɓukasz Rekucki
On 7 December 2010 18:08, Daniel Swarbrick wrote: > Forgetting namespaces or existing named URL patterns for a moment, the > major difference is that with function-based views, we were giving a > qualified "module.function" parameter to reverse() or {% url %}. > > How can we do that with class-bas

Re: Migrating to class-based views and django.core.urlresolvers.reverse

2010-12-07 Thread Benjamin Wohlwend
Hi Daniel On Tue, Dec 7, 2010 at 6:08 PM, Daniel Swarbrick wrote: > Forgetting namespaces or existing named URL patterns for a moment, the > major difference is that with function-based views, we were giving a > qualified "module.function" parameter to reverse() or {% url %}. > > How can we do th

Re: Migrating to class-based views and django.core.urlresolvers.reverse

2010-12-07 Thread Daniel Swarbrick
Forgetting namespaces or existing named URL patterns for a moment, the major difference is that with function-based views, we were giving a qualified "module.function" parameter to reverse() or {% url %}. How can we do that with class-based views, without naming every URL pattern? Or is it not pos

Re: Migrating to class-based views and django.core.urlresolvers.reverse

2010-12-07 Thread burc...@gmail.com
Hi Daniel, I'm not core developer, but I think http://docs.djangoproject.com/en/dev/topics/http/urls/#defining-url-namespaces should be used. you can use reverse("yournamespace:someview"), and it's also cool to do things like this in settings.py: reverse_lazy = lazy(reverse, str) LOGIN_REDIRECT_