[Answered ]-Pass HTML for value to django view (for querying database models)

1👍

Firstly , Update your html code snippet to correct form attribute "metohd" to "method" .

You are sending data via GET request . So you can access it via request.GET method .

Code snippet of django view.

def from_DB(request):
    id = request.GET.get("figure_id")
    figures_list = Figure.objects.filter(id=id)
    context = {"figures_list":figures_list}
    return render(request,"app1/data_from_DB.html",context)

This does your required work .

Leave a comment