Hi,

Something like this might work:

from home.urls import urlpatterns as home_urls


url('^home/', include(list(login_required(x) for x in home_urls)))

Collin

On Friday, January 23, 2015 at 7:09:30 PM UTC-5, Vijay Khemlani wrote:
>
> I may be mistaken, but I don't think you can decorate an entire "include" 
> call
>
> On Fri, Jan 23, 2015 at 8:51 PM, Neto <[email protected] <javascript:>
> > wrote:
>
>> Hi, I'm using login_required in url patterns but it does an error:
>>
>> urls.py
>>
>> from django.conf.urls import patterns, include, url
>> from django.contrib.auth.decorators import login_required
>>
>>
>> urlpatterns = patterns('',
>>     url(r'^home/', login_required(include('home.urls'))),
>>
>> )
>>
>>
>> error:
>> TypeError at /home/
>>
>> 'tuple' object is not callable
>>
>> how to fix this?
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/a0a93906-ce10-4b46-bb7a-67aa8d458a6c%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/a0a93906-ce10-4b46-bb7a-67aa8d458a6c%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ad2714cb-9dfc-4b62-a636-aa7d90419f6c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to