django form not rendering in template. Input fields doesn't shows up
<p>I'm not able to see the django form in my template. it is not being rendered properly. I've tried working on this, but the form not shows up. Tried the same code in a new project to test-that worked fine but here it doesn't work. This {{ form.as_p }} not shows up anything i.e. no input fields for me to enter the details and check the other part. Thanks in advance.</p>
<pre><code># forms.py

class ContactForm(forms.Form):
    contact_name = forms.CharField(required=True)
    contact_email = forms.EmailField(required=True)
    contact_subject = forms.CharField(required=True)
    content = forms.CharField(
        required=True,
        widget=forms.Textarea
    )`
</code></pre>
<p>and:</p>
<pre><code># views.py

def contact(request):
    form_class = ContactForm

    
    if request.method == 'POST':
        form = form_class(data=request.POST)

        if form.is_valid():
            contact_name = request.POST.get(
                'contact_name'
            , '')
            contact_email = request.POST.get(
                'contact_email'
            , '')
            contact_subject = request.POST.get(
                'contact_subject'
                , '')
            form_content = request.POST.get('content', '')

            # Email the profile with the
            # contact information
            template = get_template('contact_template.txt')
            context = Context({
                'contact_name': contact_name,
                'contact_email': contact_email,
                'contact_subject' : contact_subject,
                'form_content': form_content,
            })
            content = template.render(context)

            email = EmailMessage(
                &quot;New contact form submission&quot;,
                content,
                &quot;Your website&quot; +'',
                ['youremail@gmail.com'],
                headers = {'Reply-To': contact_email }
            )
            email.send()
            return redirect('contact')

    return render(request, 'contact.html', {
        'form': form_class,
    })
</code></pre>
<p>The template for the same looks like this.</p>
<h1>template</h1>
<pre><code> &lt;section id=&quot;contact&quot;&gt;
        &lt;div class=&quot;container text-center&quot;&gt;
            &lt;div class=&quot;row text-center&quot;&gt;
                &lt;div class=&quot;bg-image&quot;&gt;
                    &lt;div class=&quot;col-md-6 col-md-offset-3 text-center share-text wow animated zoomInDown heading-text&quot;&gt;
                        &lt;p class=&quot;heading&quot;&gt;
                            If you got any questions, please do not hesitate to send us a message.
                        &lt;/p&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
            &lt;/div&gt;

                {% block content %}
                &lt;h1&gt;Contact&lt;/h1&gt;
                &lt;form role=&quot;form&quot; action=&quot;&quot; method=&quot;post&quot;&gt;{% csrf_token %}

                    {{ form.as_p }}
                    
                    &lt;button type=&quot;submit&quot;&gt;Submit&lt;/button&gt;
                &lt;/form&gt;
                {% endblock %}
        &lt;/div&gt;
    &lt;/section&gt;
</code></pre>