Articles → DJANGO → Context In Templates In Django

Context In Templates In Django

Context In Templates


  1. Create a template with template variable.
  2. Pass context in function-based view.

Create A Template With Template Variable

		<h1>This is the first heading</h1>
		<h2>This is the second heading</h2>

Pass Context In Function-Based View

def home(request):
  return render(request, "FirstTemplate.html", {
    "Name": "Karan"


Picture showing the output of the context in templates in Django
Click to Enlarge

Posted By  -  Karan Gupta
Posted On  -  Tuesday, June 11, 2019


Your Email Id  
Query/FeedbackCharacters remaining 250