Master Layout

  • Step

    Master Page

    my_tennis_club/members/templates/master.html:

    
    
                  <!DOCTYPE html>
                  <html>
                  <head>
                    <title>{% block title %}{% endblock %}</title>
                  </head>
                  <body>
    
                  {% block content %}
                  {% endblock %}
    
                  </body>
                  </html>
    
                  

    2. in child page

    my_tennis_club/members/templates/all_members.html:

    
    
                  {% extends "master.html" %}
    
                  {% block title %}
                    My Tennis Club - List of all members
                  {% endblock %}
    
    
                  {% block content %}
                    <h1>Members</h1>
                    
                    <ul>
                      {% for x in mymembers %}
                        <li><a href="details/{{ x.id }}">{{ x.firstname }} {{ x.lastname }}</a></li>
                      {% endfor %}
                    </ul>
                  {% endblock %}
    
                  

    my_tennis_club/members/templates/details.html:

    
    
                  {% extends "master.html" %}
    
                  {% block title %}
                    Details about {{ mymember.firstname }} {{ mymember.lastname }}
                  {% endblock %}
    
    
                  {% block content %}
                    <h1>{{ mymember.firstname }} {{ mymember.lastname }}</h1>
                    
                    <p>Phone {{ mymember.phone }}</p>
                    <p>Member since: {{ mymember.joined_date }}</p>
                    
                    <p>Back to <a href="/members">Members</a></p>
                    
                  {% endblock %}