What is wrong with this loop in my Django view/template? -


I hate to ask here, but I was also a people stumped and irc.

The template I am trying to display does not display the contents of the list

{{condition}} alone does not show any value what am I missing?

Template:

  {% bet for condition%} & lt; Tr & gt; & Lt; Td> & Lt; Div & gt; {{Bet.game_num}} & lt; / Div & gt; & Lt; / Td> & Lt; Td> & Lt; Div & gt; {{Bet.home_team}} & lt; / Div & gt; & Lt; / Td> & Lt; Td> & Lt; Div & gt; {{Bet.home_odds}} & lt; / Div & gt; & Lt; / Td> & Lt; Td> & Lt; Div id = "home-odds-checkbox" & gt; & Lt; Input type = "checkbox" & gt; & Lt; / Div & gt; & Lt; / Td> & Lt; Td> & Lt; Div & gt; {{Bet.visiting_team}} & lt; / Div & gt; & Lt; / Td> & Lt; Td> & Lt; Div & gt; {{Bet.visiting_odds}} & lt; / Div & gt; & Lt; / Td> & Lt; Td> & Lt; Div id = "Visiting-Odds-Checkboxes" & gt; & Lt; Input type = "checkbox" & gt; & Lt; / Div & gt; & Lt; / Td> & Lt; Td> & Lt; Div & gt; {{Bet.tie_odds}} & lt; / Div & gt; & Lt; / Td> & Lt; Td> & Lt; Div id = "tie-osse-checkbox" & gt; & Lt; Input type = "checkbox" & gt; & Lt; / Div & gt; & Lt; / Td> & Lt; / TR & gt; {% Endfor%}  

See:

  def select_bets (requested): # To get to this page, a post must be num_games = int ( Request post ['games']) + 1 # Fill BetData with teams and constraints = in class X (1, ​​num_games): try: league_id = intestine (request .post [str (x) + '-Lague' ] Play_num = integer (request.POST [str (x + + '-game_num']) HOME_TEAM = request.POST [str (x) + '-home_team'] visit_team = request.POST [str (x) + '- Visiting_team '] home_odds = name (request.POST [str (x) +' -home_odds']) visiting_odds = name (request.POST [str (x) + '-visiting_odds']) tie_odds = name (request.POST [str (X) + '-tie_odds']) skip_game = false Valu Excluding eError: league_id, game_num, home_odds, visiting_odds, tie_odds = 0,0,0,0,0 # bad OK HOME_TEAM, visiting_team = '', '' skip_game = true # Do not include login entry in affiliate partner: bets Return to render_to_response ('select_bets.html', locals (), context_instance = RequestContext (request))   

, U "2.0, 2.0 , 43555.0], [3, 3, U, '', 3.0, 3.0, 5.0]]

The template is referencing the designated field in condition , l But you have passed in an array.

League_id = league_id, HOME_TEAM = HOME_TEAM, visiting_team = visiting_team, home_odds = home_odds, visiting_odds = visiting_odds, tie_odds = tie_odds, skip_game = skip_game))

So now there is a dict with the key From your template is as it is.

Or ... Change the template to use the array you are using instead for example:

   & Lt; Div & gt; {{Bet.game_num}} & lt; / Div & gt; & Lt; / Td>  

Use:

  & lt; Td> & Lt; Div & gt; {{Bet.0}} & lt; / Div & gt; & Lt; / Td>  

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -