#1 by Floria
Hi all, I have several apps and wanna pass the first app's payoff list to the last app. I store the first app's multi rounds payoff in a participant list. It works to show the whole list in other app page, but when I wanna show single element with from the list using list[index], it turns out to be 'Unparsable argument'. May I check how to show specific element of a list on html?
#2
by
ccrabbe
Hi Floria -
The way I would do this is to pick out that element in vars_for_template, and then display it.
so:
class ListItem(Page):
@staticmethod
def vars_for_template(player: Player):
rval = {}
rval['list_item'] = player.participant.vars['first_apps_payoff_list'][0]
return rval
And then in the template I would use {{ list_item }} to display it. You can use vars_for_template to prepare any more-complicated template items on the python-side of things and still display them in the template.
thanks,
--Chris
#3 by Floria
Hi Chris, Thanks for your prompt suggestion. It works well! Floria