def internal_link(context, name, text=None, permission=None): if permission: if permission == 'login_required': if not context.request.user.is_authenticated(): return '' else: if not context.request.user.has_perm(permission): return '' return get_internal_link(name, text)
def login_link(context): if context.request.user.is_authenticated(): return get_internal_link('logout', 'Logout') else: return get_internal_link('login', 'Login')
def admin_link(context, text='Admin'): if not context.request.user.is_superuser: return '' return get_internal_link('admin:index', text)