I know I add a foreingKey in TableB and the TabalC I can solve the problem ...
quickly but I want to know if there is any way that works and me
paint the price in the html
class TablaA(models.Model):
nombre = models.CharField(max_length=50)
# mas campos...
class TablaB(models.Model):
tabla_a = models.ForeignKey(TablaA)
precio = models.DecimalField(max_digitals=7,decimal_place=2)
# mas campos...
class TablaC(models.Model):
tabla_a = models.ForeignKey(TablaA)
cantidad = models.PositiveIntegralField()
# mas campos...
### Esta es mi vista
def mat_sal_detall(request, id_sal):
TablaC = get_object_or_404(TablaC.objects.select_related(), id = id_sal)
ctx = {'TablaC':TablaC}
return render(request, 'salida/salida_detalle.html', ctx)
This is my html_list and here I need to put the price
"Do not Price anything as if it did not exist"
<td class="text-center">{{TablaC.TablaA.nombre}}</td> # Funciona
<td class="text-center">{{TablaC.TablaA.TablaB.precio}}</td> # No funciona