Q: Add multiple products in session [Django] I would like to add several products to build my basket, but each time I add another product it overwrites the first one, how do I add several products in session?
Views.py
def cart_add(request, code):
  dico={"produits":[{'code':'MLO31','nom':'banane sucré','prix':1500}, 
  {'code':'BRAD5','nom':'pomme de terre','prix':1800}]}
  mes_produits=dico['produits']
  session=request.session
  selected_product = next((item for item in mes_produits if item["code"] == code), None)
  if selected_product != None:
    session['nom']=selected_product.get('nom')
    session['prix']=selected_product.get('prix')
  contex={'nom':session['nom'],'prix':session['prix']}

  return render(request, 'cart/cart_detail.html',contex)

cart_detail.html
   {% for key,value in request.session.items %}
        Nom : {{request.session.nom}}  
        Prix : {{request.session.prix}}<br>
   {% endfor %}

