[Fixed]-Send html input to views.py in Django

1👍

For some reason you’re rendering your template the hard way, which bypasses all the automatic things that Django does for you: most importantly, running context processors that include the CSRF token.

Your view should be this:

def home(request):
    input=Input.objects.all()
    context={
        'input':input,
    }
    return render(request, 'home/index.html', context)

Note also that your setting of Input.input_text in the result view makes no sense at all; you need to create an instance of Input, set its input_text, then save it.

Leave a comment