'How to make a preview page showing form values from different pages?
I made a multi-step but I divided it into different pages, for example step1.html, step2.html, step3.html. Each one has a "next" button that saves the information, and serves. When they get to step7 it has to display the information from step1, step2 and so on. It serves as a preview for people to see everything they have written in the previous steps and then they must click to accept, in fact I found this [solution][1] but I don't know how to implement it when I have 7 forms. What can I do?
views.py
class step7(ListView):
model=Presupuestos
template_name='Presupuestos/new-estimate-7-preview.html'
context_object_name='presupuestos'
queryset=Presupuestos.objects.all()
models.py
class Presupuestos(models.Model):
cliente= models.ForeignKey(Clientes, on_delete=models.SET_NULL, null=True)
carro=models.ForeignKey(Carro, on_delete=models.SET_NULL, null=True)
mano_obra=models.ForeignKey(ManoObra, on_delete=models.SET_NULL, null=True)
parte=models.ForeignKey(Parte, on_delete=models.SET_NULL, null=True)
garantia=models.CharField(max_length=255,default=0)
pago = models.ForeignKey(Pagos, on_delete=models.SET_NULL, null=True)
foto = models.ForeignKey(Foto, on_delete=models.SET_NULL, null=True)
tecnicos=models.ForeignKey(Tecnicos, on_delete=models.SET_NULL, null=True)
#detalle=models.ForeignKey(Detalle, on_delete=models.SET_NULL, null=True)
def __str__(self):
return f'{self.cliente} {self.carro}{self.mano_obra} {self.parte}{self.garantia}' \
f'{self.pago}{self.foto}{self.tecnicos}'
new-estimate-7-preview.py
<div class="invoice-title">
{% if presupuestos %}
<h4 class="float-end font-size-16">Estimate #0001 <span class="badge bg-success font-size-12 ms-2">Paid</span></h4>
<div class="mb-4">
<strong>LOGO</strong>
</div>
{% for presupuesto in presupuestos %}
<div class="text-muted">
<p class="mb-1"><i class="uil uil-envelope-alt me-1"></i> {{presupuesto.cliente.correo}}</p>
<p class="mb-1"><i class="uil uil-phone me-1"></i> {{presupuesto.cliente.nombre}}</p>
</div>
{% endfor %}
{% endif %}
</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 |
|---|
