Search code examples
jquerypythondjango-formsdjango-templatesdjango-context

Django - Context not available in template tag include


<form class="signup" id="signup_form" method="post" action="{% url 'account_signup' %}">
   {{ form.subscription_year_plan }}
   <div class="page1"> {% include "account/signup_1.html" %} </div>
   <div class="page2"> {% include "account/signup_2.html" %} </div>
</form>

This is a part of my html. {{ form.subscription_year_plan }} is available outside and inside signup_1.html but not inside signup_2.html.

What'd be the problem?


Solution

  • Got it. I was trying to use {{ form.subscription_year_plan }} inside a div in signup_2.html which is being populated by ajax on document ready.