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
5ee8933e
Commit
5ee8933e
authored
Mar 27, 2023
by
justin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Created detail HTML pages for each book
parent
4b2ebb81
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
63 additions
and
10 deletions
+63
-10
models.py
justinreyes_reading/bookshelf/models.py
+7
-0
book_details.html
...s_reading/bookshelf/templates/bookshelf/book_details.html
+23
-0
books.html
justinreyes_reading/bookshelf/templates/bookshelf/books.html
+12
-3
home.html
justinreyes_reading/bookshelf/templates/bookshelf/home.html
+4
-0
urls.py
justinreyes_reading/bookshelf/urls.py
+10
-2
views.py
justinreyes_reading/bookshelf/views.py
+7
-1
base.html
justinreyes_reading/templates/base.html
+0
-4
No files found.
justinreyes_reading/bookshelf/models.py
View file @
5ee8933e
from
django.db
import
models
from
django.db
import
models
from
django.urls
import
reverse
from
django.core.exceptions
import
ValidationError
from
django.core.exceptions
import
ValidationError
...
@@ -31,3 +32,9 @@ class Books(models.Model):
...
@@ -31,3 +32,9 @@ class Books(models.Model):
def
__str__
(
self
):
def
__str__
(
self
):
return
self
.
title
return
self
.
title
def
get_absolute_url
(
self
):
return
reverse
(
"book-detail"
,
kwargs
=
{
"pk"
:
self
.
pk
},
)
justinreyes_reading/bookshelf/templates/bookshelf/book_details.html
0 → 100644
View file @
5ee8933e
{% extends 'base.html' %}
{% block title %} {{ object.title }} {% endblock %}
{% block content %}
<div
class=
"book-details"
>
<h1>
{{ object.title }}
</h1>
<ul>
<li>
{{ object.author }}
</li>
<li>
{{ object.publisher }}
</li>
<li>
{{ object.year_published }}
</li>
<li>
{{ object.isbn }}
</li>
<li>
{{ object.blurb }}
</li>
</ul>
</div>
<ul>
<li><a
href=
"/home"
>
Home
</a></li>
<li><a
href=
"/books"
>
Books
</a></li>
<li><a
href=
"/authors"
>
Authors
</a></li>
</ul>
{% endblock %}
justinreyes_reading/bookshelf/templates/bookshelf/books.html
View file @
5ee8933e
{% extends 'base.html' %} {% block content %}
{% extends 'base.html' %}
{% block title %} My Favorite Books {% endblock %}
{% block content %}
<h1>
Justin' Favorite Books
</h1>
<h1>
Justin' Favorite Books
</h1>
<ul>
<ul>
{% for
book in bookL
ist %}
{% for
object in object_l
ist %}
<a
><li>
{{book
.title}}
</li></a>
<a
href=
"{{object.get_absolute_url}}"
><li>
{{object
.title}}
</li></a>
{% endfor %}
{% endfor %}
</ul>
</ul>
<ul>
<li><a
href=
"/home"
>
Home
</a></li>
<li><a
href=
"/authors"
>
Authors
</a></li>
</ul>
{% endblock %}
{% endblock %}
justinreyes_reading/bookshelf/templates/bookshelf/home.html
View file @
5ee8933e
...
@@ -6,4 +6,8 @@
...
@@ -6,4 +6,8 @@
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 @
5ee8933e
from
django.urls
import
path
from
django.urls
import
path
from
.views
import
*
from
.views
import
(
index
,
BookListView
,
BookDetailView
,
)
urlpatterns
=
[
urlpatterns
=
[
path
(
"home/"
,
index
,
name
=
"home"
),
path
(
"home/"
,
index
,
name
=
"home"
),
path
(
"books/"
,
books
,
name
=
"books"
),
path
(
"books/"
,
BookListView
.
as_view
(),
name
=
"book-list"
,
),
path
(
"books/<int:pk>/detail"
,
BookDetailView
.
as_view
(),
name
=
"book-detail"
),
path
(
"books/<int:pk>/detail"
,
BookDetailView
.
as_view
(),
name
=
"book-detail"
),
]
]
justinreyes_reading/bookshelf/views.py
View file @
5ee8933e
...
@@ -22,8 +22,14 @@ def books(request):
...
@@ -22,8 +22,14 @@ def books(request):
)
)
class
Book
DetailView
(
View
):
class
Book
ListView
(
List
View
):
model
=
Books
model
=
Books
template_name
=
"bookshelf/books.html"
class
BookDetailView
(
DetailView
):
model
=
Books
template_name
=
"bookshelf/book_details.html"
# class BooksView(View):
# class BooksView(View):
...
...
justinreyes_reading/templates/base.html
View file @
5ee8933e
...
@@ -10,9 +10,5 @@
...
@@ -10,9 +10,5 @@
<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