Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
brevinque_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
Nate Brevin A. Que
brevinque_reading
Commits
1693e22b
Commit
1693e22b
authored
Mar 28, 2023
by
Nate Brevin A. Que
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented the app-level templates, and configured the urls.
parent
32df5724
Pipeline
#3015
canceled with stages
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
131 additions
and
2 deletions
+131
-2
author_details.html
...reading/bookshelf/templates/bookshelf/author_details.html
+20
-0
authors.html
brevinque_reading/bookshelf/templates/bookshelf/authors.html
+15
-0
book_details.html
...e_reading/bookshelf/templates/bookshelf/book_details.html
+16
-0
books.html
brevinque_reading/bookshelf/templates/bookshelf/books.html
+15
-0
home.html
brevinque_reading/bookshelf/templates/bookshelf/home.html
+19
-0
urls.py
brevinque_reading/bookshelf/urls.py
+13
-0
views.py
brevinque_reading/bookshelf/views.py
+31
-1
urls.py
brevinque_reading/brevinque_reading/urls.py
+2
-1
No files found.
brevinque_reading/bookshelf/templates/bookshelf/author_details.html
0 → 100644
View file @
1693e22b
{% extends 'base.html' %}
{% block title %}{{ author }}{% endblock %}
{% block content %}
<h1>
{{ author }}
</h1>
<h3>
{{ author.age }}
<br>
{{ author.nationality }}
<br>
{{ author.bio }}
</h3><br>
<h3>
Books by {{ author }} I love:
</h3>
<ul>
{% for book in author.books_set.all %}
<li><a
href=
"http://127.0.0.1:8000/{{ book.get_absolute_url }}"
>
{{ book.title }}
</a></li>
{% endfor %}
</ul>
{% endblock %}
{% block scripts %}
<a
href=
"http://127.0.0.1:8000/home"
>
Home
</a>
<a
href=
"http://127.0.0.1:8000/books"
>
Books
</a>
<a
href=
"http://127.0.0.1:8000/authors"
>
Authors
</a>
{% endblock %}
\ No newline at end of file
brevinque_reading/bookshelf/templates/bookshelf/authors.html
0 → 100644
View file @
1693e22b
{% extends 'base.html' %}
{% block title %}My Favorite Authors{% endblock %}
{% block content %}
<h1>
{{ nickname }}'s Favorite Authors
</h1>
<ul><h3>
{% for author in authors %}
<li><a
href=
"{{ author.get_absolute_url }}"
>
{{ author }}
</li>
{% endfor %}
</h3></ul>
{% endblock %}
{% block scripts %}
<a
href=
"http://127.0.0.1:8000/home"
>
Home
</a>
<a
href=
"http://127.0.0.1:8000/books"
>
Books
</a>
{% endblock %}
\ No newline at end of file
brevinque_reading/bookshelf/templates/bookshelf/book_details.html
0 → 100644
View file @
1693e22b
{% extends 'base.html' %}
{% block title %}{{ book.title }}{% endblock %}
{% block content %}
<h1>
{{ book.title }}
</h1>
<h3><a
href=
"{{ book.author.get_absolute_url }}"
>
{{ book.author }}
</a><br>
{{ book.publisher }}
<br>
{{ book.year_published }}
<br>
{{ book.ISBN }}
<br>
{{ book.blurb }}
</h3>
{% endblock %}
{% block scripts %}
<a
href=
"http://127.0.0.1:8000/home"
>
Home
</a>
<a
href=
"http://127.0.0.1:8000/books"
>
Books
</a>
<a
href=
"http://127.0.0.1:8000/authors"
>
Authors
</a>
{% endblock %}
\ No newline at end of file
brevinque_reading/bookshelf/templates/bookshelf/books.html
0 → 100644
View file @
1693e22b
{% extends 'base.html' %}
{% block title %}My Favorite Books{% endblock %}
{% block content %}
<h1>
{{ nickname }}'s Favorite Books
</h1>
<ul><h3>
{% for book in books %}
<li><a
href=
"{{ book.get_absolute_url }}"
>
{{ book }}
</li>
{% endfor %}
</h3></ul>
{% endblock %}
{% block scripts %}
<a
href=
"http://127.0.0.1:8000/home"
>
Home
</a>
<a
href=
"http://127.0.0.1:8000/authors"
>
Authors
</a>
{% endblock %}
\ No newline at end of file
brevinque_reading/bookshelf/templates/bookshelf/home.html
0 → 100644
View file @
1693e22b
{% extends 'base.html' %}
{% block title %}My Favorite Books
&
Authors{% endblock %}
{% block content %}
<h1>
Welcome to {{ nickname }}'s Database of
<br>
Favorite Books and Authors!
</h1><br><br>
<h3>
Not much of a book reader myself, but I do read
<br>
and enjoy some books involving fantasy (i.e the
<br>
books from the Percy Jackson and Harry Potter
<br>
series, written by Rick Riordan and J.K. Rowling
<br>
respectively). Other books in this database are
<br>
some of the books I got introduced to when I was
<br>
a kid, either through movies or school.
</h3><br><br>
{% endblock %}
{% block scripts %}
<a
href=
"http://127.0.0.1:8000/books"
>
Books
</a>
<a
href=
"http://127.0.0.1:8000/authors"
>
Authors
</a>
{% endblock %}
\ No newline at end of file
brevinque_reading/bookshelf/urls.py
0 → 100644
View file @
1693e22b
from
django.urls
import
path
from
.views
import
homepage_view
,
BooksListView
,
BooksDetailView
,
AuthorListView
,
AuthorDetailView
urlpatterns
=
[
path
(
'home/'
,
homepage_view
,
name
=
'home'
),
path
(
'books/'
,
BooksListView
.
as_view
(),
name
=
'books-list'
),
path
(
'books/<int:pk>/details'
,
BooksDetailView
.
as_view
(),
name
=
'book-details'
),
path
(
'authors/'
,
AuthorListView
.
as_view
(),
name
=
'authors-list'
),
path
(
'authors/<int:pk>/details'
,
AuthorDetailView
.
as_view
(),
name
=
'author-details'
),
]
app_name
=
"bookshelf"
\ No newline at end of file
brevinque_reading/bookshelf/views.py
View file @
1693e22b
from
django.shortcuts
import
render
from
django.views.generic.list
import
ListView
from
django.views.generic.detail
import
DetailView
# Create your views here.
from
.models
import
Books
,
Author
def
homepage_view
(
request
):
return
render
(
request
,
'bookshelf/home.html'
,
{
'nickname'
:
"Brevin"
})
class
BooksListView
(
ListView
):
model
=
Books
def
get
(
self
,
request
):
return
render
(
request
,
'bookshelf/books.html'
,
{
'nickname'
:
"Brevin"
,
'books'
:
self
.
model
.
objects
.
all
()})
class
BooksDetailView
(
DetailView
):
model
=
Books
def
get
(
self
,
request
,
pk
):
return
render
(
request
,
'bookshelf/book_details.html'
,
{
'book'
:
self
.
model
.
objects
.
get
(
pk
=
pk
)})
class
AuthorListView
(
ListView
):
model
=
Author
def
get
(
self
,
request
):
return
render
(
request
,
'bookshelf/authors.html'
,
{
'nickname'
:
"Brevin"
,
'authors'
:
self
.
model
.
objects
.
all
()})
class
AuthorDetailView
(
DetailView
):
model
=
Author
def
get
(
self
,
request
,
pk
):
return
render
(
request
,
'bookshelf/author_details.html'
,
{
'author'
:
self
.
model
.
objects
.
get
(
pk
=
pk
)})
\ No newline at end of file
brevinque_reading/brevinque_reading/urls.py
View file @
1693e22b
...
...
@@ -14,8 +14,9 @@ Including another URLconf
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from
django.contrib
import
admin
from
django.urls
import
path
from
django.urls
import
path
,
include
urlpatterns
=
[
path
(
''
,
include
(
'bookshelf.urls'
,
namespace
=
"bookshelf"
)),
path
(
'admin/'
,
admin
.
site
.
urls
),
]
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