Skip to content

Instantly share code, notes, and snippets.

@matthewphiong
Created August 7, 2011 08:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthewphiong/1130193 to your computer and use it in GitHub Desktop.
Save matthewphiong/1130193 to your computer and use it in GitHub Desktop.
Django custom context processor function
# The context processor function
def categories(request):
all_categories = Category.objects.all()
return {
'categories': all_categories,
}
@DamageESP
Copy link

You must import the Category model first, otherwise that code won't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment