html form error in django project
Question: I'm rather new to programming. I followed a tutorial about building a
**_django project_**. I've gotten an error that looks like this while running
the server and launching the site (error):

    
    
    TemplateSyntaxError at /
    
    Variables and attributes may not begin with underscores: 'form.as._p'
    
    Request Method:     GET
    Request URL:    http://127.0.0.1:8000/
    Django Version:     1.9
    Exception Type:     TemplateSyntaxError
    Exception Value:    
    
    Variables and attributes may not begin with underscores: 'form.as._p'
    
    Exception Location:     /home/vagrant/Desktop/lwc2/local/lib/python2.7/site-packages/django/template/base.py in parse, line 514
    Python Executable:  /home/vagrant/Desktop/lwc2/bin/python
    Python Version:     2.7.3
    Python Path:    
    
    ['/home/vagrant/Desktop/lwc2/website',
     '/home/vagrant/Desktop/lwc2/lib/python2.7',
     '/home/vagrant/Desktop/lwc2/lib/python2.7/plat-linux2',
     '/home/vagrant/Desktop/lwc2/lib/python2.7/lib-tk',
     '/home/vagrant/Desktop/lwc2/lib/python2.7/lib-old',
     '/home/vagrant/Desktop/lwc2/lib/python2.7/lib-dynload',
     '/usr/lib/python2.7',
     '/usr/lib/python2.7/plat-linux2',
     '/usr/lib/python2.7/lib-tk',
     '/home/vagrant/Desktop/lwc2/local/lib/python2.7/site-packages',
     '/home/vagrant/Desktop/lwc2/lib/python2.7/site-packages']
    
    Server time:    Thu, 10 Dec 2015 15:04:07 +0000
    Error during template rendering
    
    In template /home/vagrant/Desktop/lwc2/website/website/templates/home.html, error at line 9
    Variables and attributes may not begin with underscores: 'form.as._p'
    1   {% extends "base.html" %}
    2   
    3   
    4   {% block content %}
    5   
    6   <h1>Hello, welcome to the home page</h1>
    7   
    8   <form>
    9       {{form.as._p }}
    10  </form>
    11  
    12  
    13  
    14  {% endblock %}
    

This is a the code that's defining my form : (inside `form.py`)

    
    
    from django import forms
    
    class EmailForm(forms.Form):
        email = forms.EmailField()
    
    `
    

This is the code defining my view and implementing form : (inside `views.py`)

    
    
    from django.shortcuts import render
    from .forms import EmailForm
    def home(request):
        form = EmailForm
        context = {"form":form}
        template = "home.html"
        return render(request, template, context)
    

And this is the `home.html` thats extending the `base.html`:

    
    
    {% extends "base.html" %}
    
    
    {% block content %}
    
    <h1>Hello, welcome to the home page</h1>
    
    <form>
        {{form.as._p }}
    </form>
    
    
    
    {% endblock %}
    


Answer: You have a typo. It should be `{{ form.as_p }}`.

