Variable within a Variable

15 views
Skip to first unread message

a.diaz....@gmail.com

unread,
Oct 29, 2018, 1:22:04 PM10/29/18
to Django users
Hi,

Is it possible to have a variable within a variable...

For example

{{ flights.Legs.0|length}} 

is equal to 1 or 2 or basically a integer. Then i would like to connect this to something like:

{{flights.Legs.0.InboundR.X.ATime}} where in stead of the X, I would like to have the value of {{ flights.Legs.0|length}}.

I tried something like this,

{{flights.Legs.0.InboundR.(flights.Legs.0|length).ATime}}

 and it did not work.

Any help will be extremple appreciated. 

Regards,

Alberto

Jason

unread,
Oct 29, 2018, 1:25:40 PM10/29/18
to Django users
sounds like you would be better off with a template tag
Reply all
Reply to author
Forward
0 new messages