'How to show the saved data of 3 forms in my template in Django?
let's say I have a form_1 (PresupuestosClientesForm) and form_2 (PresupuestosVehiculosForm), those forms store information and they are in different html pages. I would like to have a view that presents the information saved in forms 1 and 2 in the same template. How can I do that?
With my view i am only retrieving the form but not the saved data of the form
view.py
def step7(request):
presupuestosclientesform=PresupuestosClientesForm(request.POST or None,request.FILES or None)
presupuestosvehiculosform=PresupuestosVehiculosForm(request.POST or None,request.FILES or None)
if request.method == 'POST':
pass
if presupuestosclientesform.is_valid():
presupuestosclientesform.save()
return redirect('presupuestos:index')
return render(request,'Presupuestos/new-estimate-7-preview.html',{'presupuestosclientesform':presupuestosclientesform,'presupuestosvehiculosform':presupuestosvehiculosform})
index.html
<div class="text-muted">
<p class="mb-1"><i class="uil uil-envelope-alt me-1"></i>
{{presupuestosclientesform}}
</p>
</div>
<div class="text-muted">
<p class="mb-1"><i class="uil uil-envelope-alt me-1"></i>
{{presupuestosvehiculosform}}
</p>
</div>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
