I want to modify the django form, what should I do?

Asked 2 years ago, Updated 2 years ago, 49 views

Hi, how are you?

I'm creating a login page and I'm trying to get a good bootstrap theme. I applied all the login pages that I originally created in the storeroom, but there is a problem with the form.

The old code looks like this.



    <form method="post" action=".">{% csrf_token %}
        <table border="0">
             <tr><th><label for="id_username">Username:</label></th><td>{{ form.username }}</td></tr>
            <tr><th><label for="id_password">Password:</label></th><td>{{ form.password }}</td></tr> 

        </table>
        <input type="submit" value="Sign In" />
        <input type="hidden" name="next" value="/home" />
    </form>
    <br>
    <a href="/register">Sign Up</a>

But I don't like the login page like now

I want to change it this way, but the problem with the code is the part {{form.username}} {{form.password}}. I'm checking my account by receiving my user name and password here, but what should I do to make the ID and password longer? Masters, please. I'd appreciate it if you could tell me how to change it ㅜ<

django python

2022-09-22 21:38

1 Answers

If you enter form, the id becomes id_username, so if you insert the code below, the length will be 50% of the total.

<style>
input#id_username {
    width: 50%;
}
</style>


2022-09-22 21:38

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.