[Fixed]-Showing attributes of a object in a view with django

1👍

urls.py

url(r'^getAuto/(?P<idAuto>\d+)/$', views.verAuto),

views.py

def verAuto(request, idAuto):
    auto = Auto.objects.get(idAuto=idAuto)
    ctx = {
    "auto":auto
    }
    return render(request,'vehiculo_especifico.html', ctx)

vehiculo_especifico.html

...
Marca: {{auto.Marca}}
Modelo: {{auto.Modelo}}
...

read about PEP (Style Guide for Python Code)
https://www.python.org/dev/peps/pep-0008/

Leave a comment