Form not showing up in html

This is my forms.py:

class Verify(forms.Form):
    VerificationCode = forms.CharField(max_length=6)

This is my view.py:

from .forms import Verify
def verify(request):
    form = Verify
    context={form:"form"}
    return render(request, "homePageHtml/Verification.html",context)

This is my Verification.html:

<form method="POST" autocomplete="off">
<center><table>{{form.as_table}}</table></center>{% csrf_token%}
</form>
<input type="submit" class="w3-button w3-sand w3-hover-pale-green link border" value="Verify">
<a href="/register"> <input type="button" class="w3-button w3-sand w3-hover-pale-green link border" onclick="notification" value="Back" /></a>

This problem is that the verify form created is not showing up in the desired html

this should be one line up

Review the docs at Working with forms | Django documentation | Django, in particular, how the form is being created to be passed to the context.

No, actually that’s fine where it’s located.

1 Like

Reviewed and seems like everything is right from my side. Still could not found out the error.

In the example in the referenced docs, there are two places where an instance of the form is created. What are those two lines? Follow up question, what is the line in your code where you are creating the form? Follow up question #2, what is the difference between the examples in the docs and your code?

I myself found the solution to this question:
I have written the format of rendering the context in my view wrongly, it is supposed to be:
context ={"form":form}
All set!

Django forms are an advanced set of HTML forms that can be created using python and support all features of HTML forms in a pythonic way

Render Form