Skip to content

Instantly share code, notes, and snippets.

@eclecticmiraclecat
Last active November 4, 2020 09:09
Show Gist options
  • Save eclecticmiraclecat/76d3ca0acaf30c1f5f5317cb77f2a45e to your computer and use it in GitHub Desktop.
Save eclecticmiraclecat/76d3ca0acaf30c1f5f5317cb77f2a45e to your computer and use it in GitHub Desktop.
# views.py
def display(request):
  context = {'hi': 'bob'}
  return render(request, 'firstApp/index.html', context)
<!-- index.html -->
{{ hi }}

bob

or

# views.py
def display(request):
  context = {'hi': {'name':'alice'}}
  return render(request, 'firstApp/index.html', context)
<!-- index.html -->
{{ hi.name }}

alice

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