Last active
August 29, 2015 14:15
-
-
Save ulmus/7056bad51b7d1099fe93 to your computer and use it in GitHub Desktop.
A basic way of implementing a static navbar in django with the current page marked as active
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<body> | |
{% include "navbar.html" %} | |
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NAVBAR = [ | |
{"name":"main", "label":"Main Page", "url":"/"}, | |
{"name":"games", "label":"Game Page", "url":"/games/"}, | |
] | |
def main_view_with_navbar(request): | |
# Lots of view functionality | |
return render("path/to/template.html", dictionary={ | |
"navbar" : NAVBAR, | |
"active_navigation" : "main" | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment