Hi, try:
@auth.requires(lambda: check_membership())
def index():
...your code...
четверг, 31 октября 2019 г., 5:51:34 UTC+5 пользователь Cristina Sig
написал:
>
> Hi everyone,
>
> I have two different memberships. One is 'Admin' and the other one is
> 'Schools' and what I want to do is redirect to different index pages
> depending if I'm login as Admin or as School.
> This is my try:
>
> Default.py
> def check_membership():
> if auth.has_membership(group_id='administrador'):
> redirect(URL('default', 'indexAdmin'))
> elseif:
> redirect(URL('default', 'indexSchool'))
>
>
> @auth.requires('check_membership')
> def index():
> return dict(message=T("Welcome!"))
>
> It didn't work at all, so any suggestions how to achieve that?
>
> Thanks!!
>
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/2593785c-5cd4-4cdf-8f01-ccc2ca67eb44%40googlegroups.com.