简体   繁体   中英

django 2.0 form render

I heve a problem w/ django rendering forms. In a project im using django 2.0.5 and python 3.6.4

When i want to render simple form which just heve to take url but for some reason it dose not appear on a final web page

<form action="/videoConverter/" method="get">
    {{ form }}
    <input type="submit" value="Submit"/>
</form>

Here is form.py file from django import forms

class videoUrlExtract(forms.Form):
    video_info = forms.CharField(label='Video URL:', max_length=200)

I think problem in the diference of django from tuturial and django which i use

Def index(request):
    return render(request, 'homePage.html')

tutorial it in russian but u can read code

sorry for my spelling

Yep, just forgot to add form to the context :D

def index(request):
    return render(request, 'homePage.html', {'form': videoUrlExtract()})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM