Back to articles
skeleton for a shopping page

skeleton for a shopping page

via Dev.to Webdevmember_fb082baa

{% extends "base.html" %} {% block t %} Shop {% endblock %} {% block content %} <div class= "container" > <h2> Shop <a href= "/cart" class= "btn" style= "float:right" > Cart ( {{ session.get ( 'cart' , {} ) | length }} ) </a> </h2> <form method= "GET" style= "display:flex; gap:8px; margin-bottom:16px" > <input name= "search" placeholder= "Search..." value= " {{ search }} " style= "width:auto; flex:1" > <select name= "cat" > <option value= "" > All </option> {% for category in cats %} <option {% if category == cat %} selected {% endif %} > {{ category }} </option> {% endfor %} </select> <button class= "btn" > Go </button> {% if s or cat %} <a href= "/shop" class= "btn d" > Clear </a> {% endif %} </form> <table> <tr> <th> Name </th> <th> Producer </th> <th> Category </th> <th> Price </th> <th> Stock </th> <th></th> </tr> {% for product in products %} <tr> <td><a href= "/product/ {{ product.id }} " > {{ product.name }} </a></td> <td> {{ product.first_name }} {{ product.last_name }} </td>

Continue reading on Dev.to Webdev

Opens in a new tab

Read Full Article
6 views

Related Articles