Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
justinreyes_reading
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Justin Reyes
justinreyes_reading
Commits
4b2ebb81
Commit
4b2ebb81
authored
Mar 27, 2023
by
justin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initialized HTML for list of books and base template
parent
8392e27c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
41 additions
and
7 deletions
+41
-7
books.html
justinreyes_reading/bookshelf/templates/bookshelf/books.html
+8
-0
home.html
justinreyes_reading/bookshelf/templates/bookshelf/home.html
+0
-4
urls.py
justinreyes_reading/bookshelf/urls.py
+4
-2
views.py
justinreyes_reading/bookshelf/views.py
+24
-0
urls.py
justinreyes_reading/justinreyes_reading/urls.py
+1
-1
base.html
justinreyes_reading/templates/base.html
+4
-0
No files found.
justinreyes_reading/bookshelf/templates/bookshelf/books.html
0 → 100644
View file @
4b2ebb81
{% extends 'base.html' %} {% block content %}
<h1>
Justin' Favorite Books
</h1>
<ul>
{% for book in bookList %}
<a><li>
{{book.title}}
</li></a>
{% endfor %}
</ul>
{% endblock %}
justinreyes_reading/bookshelf/templates/bookshelf/home.html
View file @
4b2ebb81
...
@@ -5,9 +5,5 @@
...
@@ -5,9 +5,5 @@
recommendations made to me by different people, especially my girlfriend. I
recommendations made to me by different people, especially my girlfriend. I
love reading horror, biographies, and more. Thanks!
love reading horror, biographies, and more. Thanks!
</p>
</p>
<ul>
<li><a
href=
"/books"
>
Books
</a></li>
<li><a
href=
"/authors"
>
Authors
</a></li>
</ul>
{% endblock %}
{% endblock %}
justinreyes_reading/bookshelf/urls.py
View file @
4b2ebb81
from
django.urls
import
path
from
django.urls
import
path
from
.views
import
index
from
.views
import
*
urlpatterns
=
[
urlpatterns
=
[
path
(
""
,
index
,
name
=
"home"
),
path
(
"home/"
,
index
,
name
=
"home"
),
path
(
"books/"
,
books
,
name
=
"books"
),
path
(
"books/<int:pk>/detail"
,
BookDetailView
.
as_view
(),
name
=
"book-detail"
),
]
]
justinreyes_reading/bookshelf/views.py
View file @
4b2ebb81
from
django.shortcuts
import
render
from
django.shortcuts
import
render
from
django.views
import
View
from
django.views
import
View
from
django.views.generic.list
import
ListView
from
django.views.generic.detail
import
DetailView
from
.models
import
Author
,
Books
def
index
(
request
):
def
index
(
request
):
...
@@ -9,6 +12,27 @@ def index(request):
...
@@ -9,6 +12,27 @@ def index(request):
)
)
def
books
(
request
):
bookList
=
Books
.
objects
.
all
()
context
=
{
"bookList"
:
bookList
}
return
render
(
request
,
"bookshelf/books.html"
,
context
,
)
class
BookDetailView
(
View
):
model
=
Books
# class BooksView(View):
# def get(self, request):
# books = Books.objects.all()
# context = {"books": books}
# return render(request, "bookshelf/books.html", context)
# class HomePageView(View):
# class HomePageView(View):
# def get(self, request):
# def get(self, request):
# return (render, "bookshelf/home.html")
# return (render, "bookshelf/home.html")
justinreyes_reading/justinreyes_reading/urls.py
View file @
4b2ebb81
...
@@ -18,5 +18,5 @@ from django.urls import path, include
...
@@ -18,5 +18,5 @@ from django.urls import path, include
urlpatterns
=
[
urlpatterns
=
[
path
(
"admin/"
,
admin
.
site
.
urls
),
path
(
"admin/"
,
admin
.
site
.
urls
),
path
(
"
home/
"
,
include
(
"bookshelf.urls"
)),
path
(
""
,
include
(
"bookshelf.urls"
)),
]
]
justinreyes_reading/templates/base.html
View file @
4b2ebb81
...
@@ -10,5 +10,9 @@
...
@@ -10,5 +10,9 @@
<body>
<body>
<div
id=
"content"
>
{% block content %}{% endblock %}
</div>
<div
id=
"content"
>
{% block content %}{% endblock %}
</div>
{% block scripts %}{% endblock %}
{% block scripts %}{% endblock %}
<ul>
<li><a
href=
"/books"
>
Books
</a></li>
<li><a
href=
"/authors"
>
Authors
</a></li>
</ul>
</body>
</body>
</html>
</html>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment