django get request from context object code example
Example: retrieve object from context in django
def index (request):
context={}
data= Data.objects.all()
filesdata =
context["info"] = data
if request.method == 'POST':
errorAndTime = addFile(request)
context["error"] = errorAndTime["error"]
context["time"] = errorAndTime["time"]
return render(request, "dataAnalysis/index.html", context=context)
{% for data in info %}
<tr>
<td>{{ data.file_id }}</td>
<td>{{ data.name }}</td>
<td>{{ data.age }}</td>
<td>{{ data.email }}</td>
<td>{{ data.phone }}</td>
<td>{{ data.gender }}</td>
</tr>
{% endfor %}