[Fixed]-Passing data view-template-view in django

1👍

You can pass the content of csv_text using an hidden input field:

<form action="/crowdin_approve/" method="POST" id="csv">
    {% csrf_token %}
    <input type="hidden" name="csv_text" value="{{ csv_text }}">
    <input type="submit" class="btn btn-xs btn-danger" value="Okay">
</form>

Then you can access it in the view this way:

def crowdin_approve(request):
    if request.method == "POST":
        csv_text = request.POST.get('csv_text', None)

Leave a comment