Thanks all for help me
El jueves, 19 de julio de 2012 15:07:44 UTC-5, Tomas Neme escribió:
-- El jueves, 19 de julio de 2012 15:07:44 UTC-5, Tomas Neme escribió:
> Thanks, the first example is exactly that i want. I try it in the Django
> Shell and it works, but; How I show the results in the template?
>
> Maybe I'm wrong, but I try to pass like { 'empresas':
> Empresa.objects.all().select_related() } ,and only can show the 'Empresa'
> attributes on the loop.
>
> I do something like this
>
> {% for a in empresa%}
> a.slogan
> a.descripcion
> a.platillo.fotografia
> {% endfor %}
as I said, you need to do a loop like the one I showed in python, but
in the template
say, for example
{% for empresa in empresas %} {# keeping your plurals straight is good
practice! #}
{% for sucursal in empresa.sucursal_set.all %}
{% for platillo in empresa.platillo_set.all %}
{% for horario in empresa.horario_set.all %}
<p>
empresa.slogan<br />
empresa.descripcion<br />
platillo.fotografia<br />
horario.foobar<br />
</p>
{% endfor %}
{% endfor %}
{% endfor %}
{% endfor %}
--
"The whole of Japan is pure invention. There is no such country, there
are no such people" --Oscar Wilde
|_|0|_|
|_|_|0|
|0|0|0|
(\__/)
(='.'=)This is Bunny. Copy and paste bunny
(")_(") to help him gain world domination.
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/EW-osAFpRxQJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment