Creating catalog templates

Now, we need to create templates for the product list and detail views. Create the following directory and file structure inside the shop application directory:

templates/    shop/        base.html        product/            list.html            detail.html

We need to define a base template, and then extend it in the product list and detail templates. Edit the shop/base.html template and add the following code to it:

{% load static %}<!DOCTYPE html><html><head>  <meta charset="utf-8" />  <title>{% block title %}My shop{% endblock %}</title>  <link href="{% static "css/base.css" %}" rel="stylesheet"></head><body>  <div id="header">    <a href="/" class="logo">My shop</a>  </div>  <div id="subheader">    <div class="cart">      Your cart is empty.    </div>  </div> <div id="content"> ...

Get Django 2 by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.