goods.html 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <!DOCTYPE html>
  2. {% load staticfiles %}
  3. <html>
  4. <head>
  5. <meta charset="utf-8">
  6. <style>
  7. img { display: inline-block; width: 150px; height: 150px; border: 1px solid gray; }
  8. th, td { margin: 0; padding: 0; width: 250px; text-align: left; }
  9. .name { font-size: 14px; font-weight: bolder; }
  10. .price { color: red; font-size: 18px; }
  11. a { display: inline-block; width: 120px; height: 30px; line-height: 30px; text-align: center; background-color: red; }
  12. a:link, a:visited { color: white; text-decoration: none; }
  13. .left { float: left; width: 1000px;}
  14. .right { float: right; }
  15. </style>
  16. </head>
  17. <body>
  18. <div class="left">
  19. <h1>商品列表</h1>
  20. <hr>
  21. </div>
  22. <div class="right">
  23. <a href="/show_cart">查看购物车</a>
  24. </div>
  25. <table style="clear:both;">
  26. <tr>
  27. <th>商品名称</th>
  28. <th>商品价格</th>
  29. <th>商品图片</th>
  30. <th>操作</th>
  31. </tr>
  32. {% for goods in goods_list %}
  33. <tr>
  34. <td class="name">{{ goods.name }}</td>
  35. <td class="price">&yen;{{ goods.price }}</td>
  36. <td>
  37. <img src="{% static goods.image %}" alt="{{ goods.name }}">
  38. </td>
  39. <td>
  40. <a href="/add_to_cart/{{ goods.id }}">加入购物车</a>
  41. </td>
  42. </tr>
  43. {% endfor %}
  44. </table>
  45. </body>
  46. </html>