Вот view.py
from django.shortcuts import render from werbs.models import Word from django.http import HttpResponse import random def wrong_werbs(request): mywords = random.choice(Word.objects.all()) # foo = request.POST["word"] # if foo != mywords.english: # print(foo) # print(mywords.english) return render(request, 'index.html', {'mywords': mywords})
Это index.html
{% block content %} <p>{{ mywords.russian }}</p> <p>{{ mywords.english }}</p> <form action="" method="POST">{% csrf_token %} <label> Type verbs: <input type="text" name="word"/> </label> <input type="submit" value="word"/> </form> {% endblock %}