Can not make Detailview render data

Hello guys I'm new with Django class based views, I'm learning.

What am I doing wrong ? It suppose to render ids but it does not

Url.py

path('v/<int:pk>', V.as_view(), name='v'),

views.py

class V(DetailView):
    model = Empresa
    template_name = 'detalle.html'

.html

{%for x in empresa_list%}

{{x.NombreEmpresa}}

{%endfor%}

THis is a DetailView, hence it passes the single object as object or empresa. You thus render this with:

{{ object.NombreEmpresa }}

and thus without a {% for … %} loop.

Back to Top