| 1 |
{% load bleach_tags %} |
| 2 |
|
| 3 |
<style> |
| 4 |
table { |
| 5 |
width: 100%; |
| 6 |
} |
| 7 |
|
| 8 |
td, th { |
| 9 |
border: 1px solid #dddddd; |
| 10 |
padding: 8px; |
| 11 |
} |
| 12 |
</style> |
| 13 |
|
| 14 |
<body> |
| 15 |
<h2>Model form example</h2> |
| 16 |
<strong>Note: You must migrate project to add person!</strong> |
| 17 |
|
| 18 |
<form action="/model_form" method="post"> |
| 19 |
{% csrf_token %} |
| 20 |
|
| 21 |
{{ form.errors }} |
| 22 |
{{ form.as_p }} |
| 23 |
|
| 24 |
<div> |
| 25 |
<input type="submit" value="Submit" /> |
| 26 |
</div> |
| 27 |
</form> |
| 28 |
|
| 29 |
<div> |
| 30 |
<h3>People list</h3> |
| 31 |
<table> |
| 32 |
<tbody> |
| 33 |
<tr> |
| 34 |
<th>Name</th> |
| 35 |
<th>Biography</th> |
| 36 |
</tr> |
| 37 |
{% for person in people %} |
| 38 |
<tr> |
| 39 |
<td>{{person.name}}</td> |
| 40 |
<td>{{person.biography|safe}}</td> |
| 41 |
</tr> |
| 42 |
{% endfor %} |
| 43 |
</tbody> |
| 44 |
</table> |
| 45 |
</div> |
| 46 |
|
| 47 |
<a href="{% url 'home' %}">Form example</a> |
| 48 |
</body> |