Search code examples
pythonframeworksresponseweb2py

Edit response logo in web2py


I am trying to edit the default logo to my own in my MODEL(menu.py). The default code for the logo is:

response.logo = A(B('web',SPAN(2),'py'),XML('™ '), _class="brand", _href="http://www.web2py.com/")

How would I change this line to display my own logo? For instance, the url for the logo might be something like "http://www.web2py.com/init/static/images/logo_lb.png"


Solution

  • Just change the content of the anchor tag to include the image:

    response.logo = A(IMG(_src=URL('static', 'images/logo_lb.png'),
                      _href=URL('default', 'index'))
    

    Note, you don't really need to use response.logo at all. You can instead just put the relevant HTML directly in the layout.html view.