Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Build a Social Network with Flask Takin' Names Login View

Yaroslav Cheremnykh
Yaroslav Cheremnykh
17,684 Points

Duplicated DOM values for the "csrf_token" in login.html

I got some odd thing in my DOM for login view. For some reason, my form has the additional field with csrf_token data. However, it has already existed as the input field out of form. The problem is that I have useless div block in my form with duplicated data. Is it the appropriate behavior of flask forms? My Python code below: <form name="login_form" action="" method="POST" class="form"> <label>Please, enter your login data</label> {{ form.hidden_tag() }} {% for field in form %} {{ render_field(field) }} {% endfor %} <button type="submit" id="submit">Login</button> </form>

HTML responce of my form below: <form name="login_form" action="" method="POST" class="form"> <label>Please, enter your login data</label> <input id="csrf_token" name="csrf_token" type="hidden" value="IjgwYTBhNWJkNTQxMDhlNjY3Mzk1MDZiYmQ1MGQ4MWI1NmQyOTVkNTMi.DYsAdQ.4G1yjSqVL3H540_slsMhCIQWm3Y">

<div class="field">
    <input id="email" name="email" placeholder="Email" type="text" value="">
</div>

<div class="field">
    <input id="password" name="password" placeholder="Password" type="password" value="">
</div>

<div class="field">
    <input id="csrf_token" name="csrf_token" placeholder="CSRF Token" type="hidden" value="IjgwYTBhNWJkNTQxMDhlNjY3Mzk1MDZiYmQ1MGQ4MWI1NmQyOTVkNTMi.DYsAdQ.4G1yjSqVL3H540_slsMhCIQWm3Y">
</div>

        <button type="submit" id="submit">Login</button>
    </form>