Add base.html and add other html files

parent dc38eaf9
{% extends 'base.html' %}
{% load static %}
{% block title %}My Favorite Authors:{% endblock %}
{% block content %}
<h1>Gareth's Favorite Authors:</h1>
<ol>
{% for object in object_list %}
<li><a href = "authors/{{ object.id }}/details/">{{ object.first_name }}, {{ object.last_name }}</a></li>
{% empty %}
<li>No books registered.</li>
{% endfor %}
</ol>
{% endblock %}
\ No newline at end of file
{% extends 'base.html' %}
{% load static %}
{% block title %}My Favorite Books:{% endblock %}
{% block content %}
<h1>Gareth's Favorite Books:</h1>
<ol>
{% for object in object_list %}
<li><a href = "books/{{ object.id }}/details/">{{ object.title }}</a></li>
{% empty %}
<li>No books registered.</li>
{% endfor %}
</ol>
{% endblock %}
\ No newline at end of file
......@@ -4,5 +4,6 @@
{% block title %}My Favorite Books and Authors{% endblock %}
{% block content %}
<h1>Hello World. This is the content</h1>
<h1>Welcome to Gareth's Database of Favorite Books and Authors!</h1>
<p>I enjoy a variety of genres, no specific one, as long as it is good.</p>
{% endblock %}
\ No newline at end of file
from django.urls import path
from .views import index
from . import views
urlpatterns = [
path('', index, name='index'),
path('home/', views.homepage_view, name='home'),
path('books/', views.book_view.as_view(), name='books'),
path('authors/', views.author_view.as_view(), name='authors'),
#path('book_details/', views.homepage_view, name='home'),
#path('author_details/', views.homepage_view, name='home'),
]
app_name = "bookshelf"
\ No newline at end of file
from django.http import HttpResponse
from django.shortcuts import render
from django.views import View
from .models import Author, Books
def index(request):
return HttpResponse("Welcome to Gareth's Music Library!")
\ No newline at end of file
def homepage_view(request):
return render(request, 'bookshelf/home.html')
class book_view(View):
def get(self, request):
book = Books.objects.order_by("title")
return render(request, 'bookshelf/books.html', {'object_list': book})
class author_view(View):
def get(self, request):
name = Author.objects.order_by("first_name")
return render(request, 'bookshelf/authors.html', {'object_list': name})
\ No newline at end of file
<html lang="en">
<head>
<link rel="stylesheet" href="style.css">
<!--<link rel="stylesheet" href="style.css">-->
<title>{% block title %}My amazing site{% endblock %}</title>
{% block styles %}{% endblock %}
</head>
......@@ -10,4 +10,4 @@
</div>
{% block scripts %}{% endblock %}
</body>
</html>
\ No newline at end of file
</html>
\ No newline at end of file
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