Try this code:
response.menu = [
[T('Lectures'), False, URL('default', 'subjects'), []],
[T('Students'), False, URL('main', 'students'), []],
[T('Professors'), False, URL('main', 'professors'), []],
[T('Blog'), False, URL('default', 'blog')],
[T('News'), False, URL('default', 'news')]
]
if auth.is_logged_in():
response.menu[1] = [T('Student:'), False, None, []]
response.menu[1][3].append((T('Dashboard'), False, URL('main',
'students')))
response.menu[1][3].append((A('---', _class="divider"), False, None))
response.menu[1][3].append((T('Assessments'), False, None))
response.menu[1][3].append((T('History'), False, None))
response.menu[1][3].append((T('Join a Class'), False, None))
Regards Martin
Am Fr., 12. Apr. 2019 um 03:34 Uhr schrieb 黄祥 <[email protected]
>:
> Also, instead of the code below, why not just:
>>
>> response.menu[1][3] = [
>> (T('Dashboard'), False, URL('main', 'students')),
>> ...
>> ]
>>
>> Anthony
>>
>
> try this from working old app in recent web2py version
> *models/menu.py*
> response.menu = [
> (T('Report'), False, URL('report', 'index'), [
> (T('Purchase Order'), False, URL('report', 'report_purchase_order'), []),
> LI(_class = "divider"), *# any solution rather than comment the #LI()*
> (T('Sale Order'), False, URL('report', 'report_sale_order'), []),
> ]),
> ]
>
> *ended with*
> web2py™ Version 2.18.5-stable+timestamp.2019.04.08.04.22.03
> Python Python 3.7.3:
> /Users/sugizo/miniconda3/envs/python3_test/bin/python (prefix:
> /Users/sugizo/miniconda3/envs/python3_test)Traceback
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
>
> Traceback (most recent call last):
> File "/Users/sugizo/project/python/web2py/gluon/restricted.py", line 219,
> in restricted
> exec(ccode, environment)
> File
> "/Users/sugizo/project/python/web2py/applications/co/views/default/index.html",
> line 60, in <module>
> <br />
> File "/Users/sugizo/project/python/web2py/gluon/html.py", line 807, in
> __getitem__
> return self.components[i]
> IndexError: list index out of range
>
>
> any suggestion?
>
> thanks and best regards,
> stifan
>
> --
> 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].
> For more options, visit https://groups.google.com/d/optout.
>
--
Mit freundlichen Grüßen / With kind regards
Martin Weissenböck
Gregor-Mendel-Str. 37, 1190 Wien
Austria / European Union
--
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].
For more options, visit https://groups.google.com/d/optout.