Created the app-level templates

parent c19ef4e0
{% extends 'base.html' %}
{% block title %} {{ author.first_name }} {{ author.last_name }} {% endblock %}
{% block header %} {{ author.first_name }} {{ author.last_name }} {% endblock %}
{% block content %}
<p>
{{ author.age }} <br>
{{ author.nationality }} <br>
{{ author.bio }} <br>
Books by {{ author.first_name }} {{ author.last_name }} I love:
</p>
{% for work in author.works.all %}
<a href="{{ work.get_absolute_url }}">{{ work.title }}</a> <br>
{% endfor %}
<br>
<a href="http://127.0.0.1:8000/books/">Books</a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="http://127.0.0.1:8000/authors/">Authors</a>
{% endblock %}
{% extends 'base.html' %}
{% block title %} My Favorite Authors {% endblock %}
{% block header %} Lance's Favorite Authors: {% endblock %}
{% block content %}
{% for author in author_list %}
<a href="{{ author.get_absolute_url }}">{{ author.first_name }} {{ author.last_name }}</a> <br>
{% endfor %}
<a href="http://127.0.0.1:8000/books/">Books</a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="http://127.0.0.1:8000/authors/">Authors</a>
{% endblock %}
{% extends 'base.html' %}
{% block title %} {{ books.title }} {% endblock %}
{% block header %} {{ books.title }} {% endblock %}
{% block content %}
<p>
{{ books.publisher }} <br>
<a href="{{ books.author.get_absolute_url }}">
{{ books.author.first_name }} {{ books.author.last_name }}
</a> <br>
{{ books.year_published }} <br>
{{ books.ISBN }} <br>
{{ books.blurb }} <br>
</p>
<a href="http://127.0.0.1:8000/books/">Books</a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="http://127.0.0.1:8000/authors/">Authors</a>
{% endblock %}
{% extends 'base.html' %}
{% block title %} My Favorite Books {% endblock %}
{% block header %} Lance's Favorite Books: {% endblock %}
{% block content %}
{% for book in book_list %}
<a href="{{ book.get_absolute_url }}">{{ book.title }}</a> <br>
{% endfor %}
<a href="http://127.0.0.1:8000/books/">Books</a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="http://127.0.0.1:8000/authors/">Authors</a>
{% endblock %}
{% extends 'base.html' %}
{% block title %} My Favorite Books & Authors {% endblock %}
{% block header %} Welcome to Lance's Database of Favorite Books and Authors! {% endblock %}
{% block content %}
<p>
</p>
<a href="http://127.0.0.1:8000/books/">Books</a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="http://127.0.0.1:8000/authors/">Authors</a>
{% endblock %}
from django.shortcuts import render
from django.http import HttpResponse
from django.views import View
from django.views.generic.list import ListView
from django.views.generic.detail import DetailView
def index(request):
return HttpResponse('Hello World! This came from the index view')
\ No newline at end of file
from .models import Author, Books
class HomepageView(View):
def get(self, request):
return render(request, 'bookshelf/home.html')
class BooksPageView(ListView):
model = Books
context_object_name = 'book_list'
class BooksDetailsView(DetailView):
model = Books
class AuthorsPageView(ListView):
model = Author
context_object_name = 'author_list'
class AuthorsDetailsView(DetailView):
model = Author
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment