Emmanuel Adu Gyamfi
Emmanuel Adu Gyamfi

Reputation: 145

Form is not appearing

How do I get my form to appear ?

So far only the html heading and the submit button are showing.

Views.py:

from django.shortcuts import render

# Create your views here.

from signups.forms import SignUpForm

def home(request):

    form = SignUpForm()

    return render(request,'signup.html')

signup.html:

<!doctype html>

    <html lang="en">

        <head>

        </head>

        <body>
            <h1>Join Now !!!</h1>
                <form action='' method='POST'>
                    {{ form.as_p }}

                    <input type='submit'>
                </form>
        </body>

    </html>

Upvotes: 1

Views: 41

Answers (1)

e4c5
e4c5

Reputation: 53734

You need to pass it to the template!

return render(request,'signup.html',{'form': form })

And then in the template display it!

{{ form.as_p }}

Upvotes: 2

Related Questions