Learn Flask Tourist Attractions move up and delete buttons

Hello everyone!

I am working on the Learn Flask Tourist Attractions project. Everything is running smooth except for the up and delete button. When I click the button I have to refresh the page for the components to render. Here is the relevant code:

`@app.route("/", methods=[“GET”, “POST”])
def locations(category):
locations = visit.get_list_by_category(category)

Check the request for form data and process

if request.method == “POST”:
[(name, action)] = request.form.items()

if action == UP_ACTION:
  visit.moveup(name)
elif action == DEL_ACTION:
  visit.delete(name)

Return the main template with variables

return render_template(‘locations.html’, template_category = category, template_categories = categories, template_locations = locations, add_location=AddLocationForm())`

`
{% for location in template_locations %}

    <tr>
      <td class="loc">{{location.name}}</td> <!-- insert location name here -->
      <td class="desc">{{location.description}}</td> <!-- insert location description here -->
      <td class="btns">
      {% if template_category != 'visited' %}

        <form method="POST">
          <input type="submit" class="up" name="{{location.name}}" value=&#8599;> <!-- set name attribute here -->
          <input type="submit" class="del" name="{{location.name}}" value="X"> <!-- set name attribute here -->
        </form>
        <!-- end if statement here -->
      {% endif %}
      </td>
    </tr>
    {% endfor %}

</tbody>`

I thought it was a server problem until I finished the program and the form renders fine. Any help is appreciated!

The same thing happens in my version of the project. This is an issue that occurs throughout all of the projects in the “Learn Flask” path. Wherein you have to refresh to see changes. I myself am currently still in the process of trying to do some of the projects in the path offline or deploy on Heroku to see if the issue doesn’t manifest there (I’m already in the last section).

It would be helpful to the community if you try to do this offline and then report back to the forum your result on whether it made a difference.

Hrmm okay sounds good I will post an update when I host it on heroku. Thanks for letting me know!