3

My web app currently has 3 pages. I obtained a user input on the first page, which I passed to my view.py, and calculated some variables I needed for my 2nd page. I want to pass the variables that exist in my 2nd page to the third page, but don't know how to go about it. Any suggestions on how to modify the html for the 2nd page to achieve this?

So far, I'm solving this problem by making my variables global in view.py. This seems to work but doesn't seem to be a viable long-term solution.

Thanks!

existing variables: thePrediction, theData

The html for the 2nd page:

        <div class = "caption-full">
              <h3>Currently, I have a {{thePercentage}} chance of getting adopted.</h3>
            {% if thePrediction[1] + thePrediction[2] >0%}
                <form action="/third_page" method="GET">
                    <button class="btn btn-large btn-info" >Go to third page</button>
                </form>

            {% endif %}
        </div>

1 Answer 1

2

I think I figured it out:

<div class = "caption-full">
                  <h3>Currently, I have a {{thePercentage}} chance of getting adopted.</h3>
                {% if thePrediction[1] + thePrediction[2] >0%}

                    <form action="/third_page" method="GET">
                        <input type="hidden" name="alignment" value="{{thePassedValue}}" />
                        <button class="btn btn-large btn-info" >Go to third page</button>

                    </form>

                {% endif %}
            </div>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.