#1 by talushka
hey all,
when coding and trying to do basic math with some variables im getting this error.
i want to show the user a picture the get an input, based on the user input he will get points:
class Player(BasePlayer):
...
current_guess = models.IntegerField(label="Please guess the price of the stock in 20 days (day 100):", blank=False)
class pic1(Page):
form_model = "player"
form_fields = ['current_guess']
if 0 <= abs(Player.current_guess - 150) < 20:
Player.total_score += 20
elif 20 <= abs(Player.current_guess - 150) - 150 < 50:
Player.total_score += 10
else:
Player.total_score -= 20
this is the HTML file, done know if it matters:
{{ block title }}
<div style="text-align: center;">
First Graph
</div>
{{ endblock }}
{{ block content }}
<div style="text-align: center;">
Your current score is {{ player.total_score }}
<P><img src = "https://i.imgur.com/Fnuwkr4.gif"
, alt = "DOGGIES!"
, style = "width:250px;height:250px;">
</P>
</div>
<P>
{{ formfield "current_guess" }}
</P>
{{ next_button }}
{{ endblock }}
thank you in advance!