Skip to content

Commit 4a7f229

Browse files
committed
Add templates
1 parent b825c34 commit 4a7f229

File tree

7 files changed

+72
-0
lines changed

7 files changed

+72
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{% extends "base_books.html" %}
2+
3+
{% block content %}
4+
<h1>{{ object.name }}</h1>
5+
<p>{{ object.salutation }}</p>
6+
<li>Email: {{ object.email }}</li>
7+
{% endblock content %}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{% extends "base_books.html" %}
2+
3+
{% block content %}
4+
<h2>Author List</h2>
5+
<ul>
6+
{% for author in object_list %}
7+
<li><a href="{% url 'books:author_detail' author.id %}">{{ author.name }}</a></li>
8+
{% endfor %}
9+
</ul>
10+
{% endblock content %}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{% extends "base_books.html" %}
2+
3+
{% block content %}
4+
<h1>{{ object.title }}</h1>
5+
<br />
6+
<li>Authors:
7+
{% for author in object.authors.all %}
8+
{{ author }}
9+
{% if not forloop.last %},{% else %}{% endif %}
10+
{% endfor %}
11+
</li>
12+
<li>Publisher: {{ object.publisher }}</li>
13+
<li>Publication date: {{ object.publication_date }}</li>
14+
{% endblock content %}

books/templates/books/book_list.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{% extends "base_books.html" %}
2+
3+
{% block content %}
4+
<h2>Book List</h2>
5+
<ul>
6+
{% for book in object_list %}
7+
<li><a href="{% url 'books:book_detail' book.id %}">{{ book.title }}</a></li>
8+
{% endfor %}
9+
</ul>
10+
{% endblock content%}

books/templates/books/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{% extends "base_books.html" %}
2+
3+
{% block content %}
4+
<h2>Books Management System</h2>
5+
<ul>
6+
{% for modelname in object_list %}
7+
{% with "books:"|add:modelname|lower|add:"_list" as urlvar %}
8+
<li><a href="{% url urlvar %}">{{ modelname }}</a></li>
9+
{% endwith %}
10+
{% endfor %}
11+
</ul>
12+
13+
{% endblock %}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{% extends "base_books.html" %}
2+
3+
{% block content %}
4+
<h1>{{ object.name }}</h1>
5+
<p>{{ object.website }}</p>
6+
<li>Address: {{ object.address }}</li>
7+
{% endblock content %}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{% extends "base_books.html" %}
2+
3+
{% block content %}
4+
<h2>Publisher List</h2>
5+
<ul>
6+
{% for publisher in object_list %}
7+
<li><a href="{% url 'books:publisher_detail' publisher.id %}">
8+
{{ publisher.name }}</a></li>
9+
{% endfor %}
10+
</ul>
11+
{% endblock content %}

0 commit comments

Comments
 (0)