Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

140
Vistas
show fixed cell empty table in django template and then populate it with session items cell by cell

as I am trying to get the functionality of clicking an item from product catalogue populate that item at the fixed cells tables say a table of 4 cells - this is to achieve make-your-box kind of functionality with assorted items - the problem is first showing empty table of 4 cells and then populating the cells one by one on the click by a buyer. What I have achieved is to be able to keep clicking the items and they will appear at the top without any table structure.

{% for product_id, item in b_data.items %}
    {% for i in item.numItems %}
        <div class="col-md-4 mb-4">
            <div class="card" style="width: 18rem;">
                <img src="/media/{{item.image}}" class="card-img-top" alt="...">
                <div class="card-body">
                <h5 class="card-title">{{item.title}}</h5>
                <p class="card-text">{{product_id}} {{item.qty}}</p>
                <div class="card-footer">
                    <a href="#" class="btn btn-primary"><i class="bi bi-cart2"></i></a>
                </div>
                </div>
            </div>
        </div>
    {% endfor %}
{% endfor %}

above template works but now if I want that - say i have a box of 4 selected by buyer then - box of 4 will appear empty and then on the click of item fro the product-catalogue appearing below the fixed table of 4 - the session will keep the information of the clicked product and each time the above template is called it'll have one item added to the session so - on the first click session object (b_data) will have one item and the table will be populated with first item and rest of the three cells will be empty on the second click session object (b_data) will have two items and the table will be populated with first and second item and rest of the two cells will be empty on the third click session will have three items and the table will be populated with first, second and third item and rest of the one cell will be empty on the fourth click session will have four items and the table will be populated with first, second, third and fourth item and all the cells will be populated on the fifth click session will have five items but the table should wrap around and the first item in the table should get overwritten by fifth item

the above code works but how to achive this functionality.... please suggest.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda