8.3 Django Template Inheritance
parent
d209a9a794
commit
430167db83
|
@ -0,0 +1,15 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>To-Do lists</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h1>{% block header_text %}{% endblock %}</h1>
|
||||||
|
<form method="POST" action="{% block form_action %}{% endblock %}">
|
||||||
|
<input name="item_text" id="id_new_item" placeholder="Enter a to-do item" />
|
||||||
|
{% csrf_token %}
|
||||||
|
</form>
|
||||||
|
{% block table %}
|
||||||
|
{% endblock %}
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -1,12 +1,5 @@
|
||||||
<html>
|
{% extends 'base.html' %}
|
||||||
<head>
|
|
||||||
<title>To-Do lists</title>
|
{% block header_text %}Start a new To-Do list{% endblock %}
|
||||||
</head>
|
|
||||||
<body>
|
{% block form_action %}/lists/new{% endblock %}
|
||||||
<h1>Your To-Do list</h1>
|
|
||||||
<form method="POST" action="/lists/new">
|
|
||||||
<input name="item_text" id="id_new_item" placeholder="Enter a to-do item" />
|
|
||||||
{% csrf_token %}
|
|
||||||
</form>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,18 +1,13 @@
|
||||||
<html>
|
{% extends 'base.html' %}
|
||||||
<head>
|
|
||||||
<title>To-Do lists</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>Your To-Do list</h1>
|
|
||||||
<form method="POST" action="/lists/{{ list.id }}/add_item">
|
|
||||||
<input name="item_text" id="id_new_item" placeholder="Enter a to-do item" />
|
|
||||||
{% csrf_token %}
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<table id="id_list_table">
|
{% block header_text %}Your To-Do list{% endblock %}
|
||||||
{% for item in list.item_set.all %}
|
|
||||||
<tr><td>{{ forloop.counter }}: {{ item.text }}</td></tr>
|
{% block form_action %}/lists/{{ list.id }}/add_item{% endblock %}
|
||||||
{% endfor %}
|
|
||||||
</table>
|
{% block table %}
|
||||||
</body>
|
<table id="id_list_table">
|
||||||
</html>
|
{% for item in list.item_set.all %}
|
||||||
|
<tr><td>{{ forloop.counter }}: {{ item.text }}</td></tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
{% endblock %}
|
Loading…
Reference in New Issue