maybe make this?
@auth.requires_login()
def index():
if auth.has_membership(group_id='administrador'):
redirect(URL('default', 'indexAdmin'))
else:
redirect(URL('default', 'indexSchool'))
четверг, 31 октября 2019 г., 8:57:39 UTC+5 пользователь Cristina Sig
написал:
>
> I tried your suggestion but it doesn't work.
> It keeps loading the index page and doesn't allow me to see the login page.
>
>
> El miércoles, 30 de octubre de 2019, 23:15:37 (UTC-3), Ruslan Gareev
> escribió:
>>
>> 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/779392a9-c585-4529-8a05-9056f102abd4%40googlegroups.com.