Place the fields of a Django form on the same line

Asked

Viewed 106 times

1

I have a form in Django and in the template I display the fields to be filled:

<div id="interval" class="form-inline form-group">
                    <div class="two wide field">
                        {% for price in prices %}
                        <div class="fields">
                            <div class="ten wide field">
                                <label>Preço</label>
                                {{ price.price }}
                            </div>

                           <div class="ten wide field">
                                <label>Inicio</label>
                                {{ price.start_time }}
                           </div>
                            <div class="ten wide field">
                                <label>Final</label>
                                {{ price.end_time }}
                            </div>
                        </div>
                    </div>

But it’s getting one field under the other:

inserir a descrição da imagem aqui

I want the fields to appear side by side, Inicio | Fim | Preco, I’ve tried to touch the Ivs but I’m not getting it, it’s something in Django?

  • How about CSS ? Without it you can’t answer in a concrete way.

  • 1

    It’s not a question of Django but css, hint: use that package to Forms

1 answer

1


I only removed the div who were inside the inputs

<div id="interval" class="form-inline">
    <div class="two wide field">
        {% for price in prices %}
        <label>Preço</label>
        {{ price.price }}
        <label>Inicio</label>
        {{ price.start_time }}
        <label>Final</label>
        {{ price.end_time }}
        </div>
</div>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.