#4: add base template; extend base template in views
This commit is contained in:
parent
fe7fce76c0
commit
b7311f2308
7 changed files with 110 additions and 62 deletions
12
templates/base.html
Normal file
12
templates/base.html
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>{% block title %}Tofu{% endblock %} - Tofu</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Tofu</h1>
|
||||
|
||||
{% block content %}No content.{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,7 +1,13 @@
|
|||
<h2>Login</h2>
|
||||
{% extends "base.html" %}
|
||||
|
||||
<form method="POST">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<button type="submit">Login</button>
|
||||
</form>
|
||||
{% block title %}Login{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h2>Login</h2>
|
||||
|
||||
<form method="POST">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<button type="submit">Login</button>
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
|
|
|||
Reference in a new issue