Sry a part of my code was wrong i use
{%for buchung in result %}
<p>{{ buchung[0][0] }}</p>
{%endfor%}
To acces the list...
Von: Szabo, Patrick (LNG-VIE)
Gesendet: Dienstag, 15. Februar 2011 15:09
An: '[email protected]'
Betreff: list to template
Hi,
What i want to do is show all DB-entries of a certain user.
These entries include foreign keys and i need to get the related objects
too and print them in a template
So what i do is this:
First i get all the objects that i need.
buchungen = Buchung.objects.filter(Mitarbeiter = request.user.id)
then i want to make a list that stores lists where each of those lists
contains an object and the related objects:
for buchung in buchungen:
books.append([buchung, buchung.Produkt, buchung.Aktivitaet])
and i pass it on to the template:
return render_to_response('main/index.html', {'user' : request.user,
'form' : f, 'result' : books}, context_instance=RequestContext(request))
Now when i try to acces that lists with
{{ buchung[0][0] }}
I get the following error:
Could not parse the remainder: '[0][0]' from 'buchung[0][0]'
How can i get acces tot hat lists ?!
Kind regards
. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
XSLT-Entwickler
LexisNexis
Marxergasse 25, 1030 Wien
mailto:[email protected]
Tel.: +43 (1) 534 52 - 1573
Fax: +43 (1) 534 52 - 146
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.