1def index (request):
2 context={}
3 data= Data.objects.all()
4 filesdata =
5 context["info"] = data
6 if request.method == 'POST':
7 errorAndTime = addFile(request)
8 context["error"] = errorAndTime["error"]
9 context["time"] = errorAndTime["time"]
10 # error = errorAndTime["error"]
11 # time = errorAndTime["time"]
12 return render(request, "dataAnalysis/index.html", context=context)
13 #When you retrieve your data just call the name of the context u don't need
14 #to call it like this context.info or something like that
15 {% for data in info %}
16 <tr>
17 <td>{{ data.file_id }}</td>
18 <td>{{ data.name }}</td>
19 <td>{{ data.age }}</td>
20 <td>{{ data.email }}</td>
21 <td>{{ data.phone }}</td>
22 <td>{{ data.gender }}</td>
23 </tr>
24 {% endfor %}
1class PublisherDetail(DetailView):
2
3 model = Publisher
4
5 def get_context_data(self, **kwargs):
6 # Call the base implementation first to get a context
7 context = super().get_context_data(**kwargs)
8 # Add in a QuerySet of all the books
9 context['book_list'] = Book.objects.all()
10 return context