Skip to main content

Quiero renderizar una lista en un template

--views.py

def main(request):
list=Hotel.objects.all()
template = get_template("index.html")
return HttpResponse(template.render({'list': list[0:max]}))

---index.html

<!DOCTYPE html>
<html>
  <head>
    <meta charset='utf-8' />

  </head>
  <body>
    <ul>
    {% for hotel in list %}
    <li>{{ hotel }}</li>
    {% endfor %}
  </ul>

  </body>
</html>

La salida que obtengo es :

[<Hotel: Hotel object>, <Hotel: Hotel object>, <Hotel: Hotel object>, <Hotel: Hotel object>, <Hotel: Hotel object>, <Hotel: Hotel object>, <Hotel: Hotel object>, <Hotel: Hotel object>, <Hotel: Hotel object>, <Hotel: Hotel object>]

Y me gustaria: . Nombre hotel 1 .Nombre hotel 2