Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
Deokhyun_Lee_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
Deokhyun Lee
Deokhyun_Lee_reading
Commits
3b29bdda
Commit
3b29bdda
authored
Mar 27, 2023
by
Deokhyun Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
now pages for books and books
parent
0ca477be
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
59 additions
and
13 deletions
+59
-13
urls.cpython-39.pyc
bookshelf/__pycache__/urls.cpython-39.pyc
+0
-0
views.cpython-39.pyc
bookshelf/__pycache__/views.cpython-39.pyc
+0
-0
index.html
bookshelf/templates/authors/index.html
+12
-8
book.html
bookshelf/templates/books/book.html
+25
-0
index.html
bookshelf/templates/books/index.html
+10
-1
index.html
bookshelf/templates/home/index.html
+1
-0
urls.py
bookshelf/urls.py
+3
-1
views.py
bookshelf/views.py
+8
-2
base.html
templates/base.html
+0
-1
No files found.
bookshelf/__pycache__/urls.cpython-39.pyc
View file @
3b29bdda
No preview for this file type
bookshelf/__pycache__/views.cpython-39.pyc
View file @
3b29bdda
No preview for this file type
bookshelf/templates/authors/index.html
View file @
3b29bdda
{% extends 'base.html'%}
{% block title %}
My Favorite
Books
&
Authors
My Favorite Authors
{% endblock %}
{% block content %}
<h1>
Welcome to Deokhyun's Database of Favorite Books and Authors!
</h1>
<p>
My personal preference:
<p>
I love reading fantasy or Science Fiction!
Therefore, Frank Herbert's
Dune is one of the best
American authors for me!
</p></p>
<a
href=
"/books"
>
Books
</a>
&
nbsp
&
nbsp
&
nbsp
&
nbsp
&
nbsp
<a
href=
"/authors"
>
Authors
</a>
<h1>
Deokhyun's Favorite Authors:
</h1>
{% if authors %}
<ul>
{% for author in authors %}
<a
href=
{{author.id}}/details
>
{{ author.first_name }}{{ author.last_name}}
</a><br>
{% endfor %}
</ul>
{% else %}
<p>
No Available Authors.
</p>
{% endif %}
<a
href=
"/home"
>
Home
</a>
&
nbsp
&
nbsp
&
nbsp
&
nbsp
&
nbsp
<a
href=
"/books"
>
Books
</a>
{% endblock %}
\ No newline at end of file
bookshelf/templates/books/book.html
0 → 100644
View file @
3b29bdda
{% extends 'base.html'%}
{% block title %}
{% if book %}
{{book.title}}
{% else %}
<p>
No Available Books.
</p>
{% endif %}
{% endblock %}
{% block content %}
{% if book %}
<h1>
{{book.title}}
</h1>
<ul>
{{book.author}}
<br>
{{book.publisher}}
<br>
{{book.year_published}}
<br>
{{book.ISBN}}
<br>
{{book.blurb}}
<br>
</ul>
{% else %}
<p>
No Available Books.
</p>
{% endif %}
<a
href=
"/home"
>
Home
</a>
&
nbsp
&
nbsp
&
nbsp
&
nbsp
&
nbsp
<a
href=
"/books"
>
Books
</a>
&
nbsp
&
nbsp
&
nbsp
&
nbsp
&
nbsp
<a
href=
"/authors"
>
Authors
</a>
{% endblock %}
\ No newline at end of file
bookshelf/templates/books/index.html
View file @
3b29bdda
...
...
@@ -6,5 +6,14 @@
{% block content %}
<h1>
Deokhyun's Favorite Books:
</h1>
{% if books %}
<ul>
{% for book in books %}
<a
href=
{{book.id}}/details
>
{{ book.title }}
</a><br>
{% endfor %}
</ul>
{% else %}
<p>
No Available Books.
</p>
{% endif %}
<a
href=
"/home"
>
Home
</a>
&
nbsp
&
nbsp
&
nbsp
&
nbsp
&
nbsp
<a
href=
"/authors"
>
Authors
</a>
{% endblock %}
\ No newline at end of file
bookshelf/templates/home/index.html
View file @
3b29bdda
...
...
@@ -11,4 +11,5 @@
Therefore, Frank Herbert's
Dune is one of the best
American authors for me!
</p></p>
<a
href=
"/books"
>
Books
</a>
&
nbsp
&
nbsp
&
nbsp
&
nbsp
&
nbsp
<a
href=
"/authors"
>
Authors
</a>
{% endblock %}
\ No newline at end of file
bookshelf/urls.py
View file @
3b29bdda
...
...
@@ -4,5 +4,7 @@ from . import views
urlpatterns
=
[
path
(
'home/'
,
views
.
home
,
name
=
"home"
),
path
(
'books/'
,
views
.
books
,
name
=
"books"
),
path
(
'authors/'
,
views
.
authors
,
name
=
"authors"
)
path
(
'books/<int:pk>/details'
,
views
.
books_detail
,
name
=
"books_detail"
),
path
(
'authors/'
,
views
.
authors
,
name
=
"authors"
),
path
(
'authors/<int:pk>/details'
,
views
.
authors_detail
,
name
=
"authors_detail"
),
]
\ No newline at end of file
bookshelf/views.py
View file @
3b29bdda
...
...
@@ -20,7 +20,13 @@ def authors(request):
# for Books page
def
books
(
request
):
context
=
{}
books
=
Books
.
objects
.
order_by
(
'year_published'
)
context
=
{
'books'
:
books
}
template
=
loader
.
get_template
(
'books/index.html'
)
return
HttpResponse
(
template
.
render
(
context
,
request
))
\ No newline at end of file
def
books_detail
(
request
,
pk
):
book
=
Books
.
objects
.
get
(
pk
=
pk
)
context
=
{
'book'
:
book
}
template
=
loader
.
get_template
(
'books/book.html'
)
return
HttpResponse
(
template
.
render
(
context
,
request
))
\ No newline at end of file
templates/base.html
View file @
3b29bdda
...
...
@@ -8,6 +8,5 @@
<div
class=
"container"
>
{% block content %}{% endblock %}
</div>
<a
href=
"/books"
>
Books
</a>
&
nbsp
&
nbsp
&
nbsp
&
nbsp
&
nbsp
<a
href=
"/authors"
>
Authors
</a>
</body>
</html>
\ No newline at end of file
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