Created
August 7, 2011 08:25
-
-
Save matthewphiong/1130193 to your computer and use it in GitHub Desktop.
Django custom context processor function
This file contains hidden or 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
# The context processor function | |
def categories(request): | |
all_categories = Category.objects.all() | |
return { | |
'categories': all_categories, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You must import the Category model first, otherwise that code won't work.