Commit 99b641f5 authored by Ysabella Panghulan's avatar Ysabella Panghulan

created homepage template & view and added path to urls.py

parent 5d178864
{%extends 'base.html'%}
{% block title %} My Favorite Books & Authors {% endblock %}
{% block header %}
<h2> Welcome to Bella's Database of Favorite Books & Authors </h2>
{% endblock %}
{% block body %}
<div class="home-content">
{% block content %}
<p> Personally, I used to be more interested in movies and series than reading books. Reading books always felt like a chore to me, and I struggled to find books that kept me engaged and interested. However, over time, I discovered the world of self-help books and found myself drawn to the practical advice and guidance they offered. These books helped me learn new skills, gain new perspectives, and develop a better understanding of myself and the world around me. My favorite books include: Ikigai: The Japanese Secret to a Long and Happy Life and The Subtle Art of Not Giving a F*ck. </p>
<div class="home-links">
<ul>
<li><a href="/books">Books</a></li>
<li><a href="/authors">Authors</a></li>
</ul>
</div>
{% endblock %}
</div>
{% endblock %}
\ No newline at end of file
from django.urls import path
from . import views
from .views import Homepage
urlpatterns = [
path('home', Homepage.as_view(), name='home'),
]
\ No newline at end of file
from django.http import HttpResponse
from .models import Author, Books
from django.views import View
from django.shortcuts import render
# Create your views here.
class Homepage(View):
def get(self, request):
books = Books.objects.all()
authors = Author.objects.all()
context = {
'books': books,
'authors': authors,
}
return render(request, 'bookshelf/home.html', context)
\ 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