Tuesday, October 11, 2011

Re: Django - how to create a private subpage?

heya,

I might be misunderstanding your requriements, but could you use the @user_passes_test decorator with a has_perm check?

@user_passes_test(lambda u: u.has_perm('private_pages.foo'))

https://docs.djangoproject.com/en/dev/topics/auth/

You can probably make the lambda a bit smarter, instead of using has_perm, check if the pagename matches the username.

Cheers,
Victor

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/CxrZ-hFFD9QJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate