@register.function
def sidebar(app):
 from olympia.addons.models import Category
 if (app is None):
  return ([], [])
 qs = Category.objects.filter(application=app.id, weight__gte=0, type=amo.ADDON_EXTENSION)
 categories = sorted(qs, key=attrgetter('weight', 'name'))
 Type = collections.namedtuple('Type', 'id name url')
 base = urlresolvers.reverse('home')
 types = [Type(99, _('Collections'), (base + 'collections/'))]
 shown_types = {amo.ADDON_PERSONA: urlresolvers.reverse('browse.personas'), amo.ADDON_DICT: urlresolvers.reverse('browse.language-tools'), amo.ADDON_SEARCH: urlresolvers.reverse('browse.search-tools'), amo.ADDON_THEME: urlresolvers.reverse('browse.themes')}
 titles = dict(amo.ADDON_TYPES, **{amo.ADDON_DICT: _('Dictionaries & Language Packs')})
 for (type_, url) in shown_types.items():
  if (type_ in app.types):
   types.append(Type(type_, titles[type_], url))
 return (categories, sorted(types, key=(lambda x: x.name)))

@ register . function def sidebar ( app ) : from olympia . addons . models import Category if ( app is None ) : return ( [ ] , [ ] ) qs = Category . objects . filter ( application = app . id , weight__gte = 0 , type = amo . ADDON_EXTENSION ) categories = sorted ( qs , key = attrgetter ( 'weight' , 'name' ) ) Type = collections . namedtuple ( 'Type' , 'id name url' ) base = urlresolvers . reverse ( 'home' ) types = [ Type ( 99 , _ ( 'Collections' ) , ( base + 'collections/' ) ) ] shown_types = { amo . ADDON_PERSONA : urlresolvers . reverse ( 'browse.personas' ) , amo . ADDON_DICT : urlresolvers . reverse ( 'browse.language-tools' ) , amo . ADDON_SEARCH : urlresolvers . reverse ( 'browse.search-tools' ) , amo . ADDON_THEME : urlresolvers . reverse ( 'browse.themes' ) } titles = dict ( amo . ADDON_TYPES , ** { amo . ADDON_DICT : _ ( 'Dictionaries & Language Packs' ) } ) for ( type_ , url ) in shown_types . items ( ) : if ( type_ in app . types ) : types . append ( Type ( type_ , titles [ type_ ] , url ) ) return ( categories , sorted ( types , key = ( lambda x : x . name ) ) )
yaml: sidebar allows you to add links in the sidebar .