Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mattarpas_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
Matthew Karl David P. Arpas
mattarpas_reading
Commits
7c7b071b
Commit
7c7b071b
authored
Mar 28, 2023
by
Matthew Karl David P. Arpas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented every view in the specs with working links and the correct layout
parent
2fdd6b7f
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
52 additions
and
15 deletions
+52
-15
urls.cpython-311.pyc
mattarpas_reading/bookshelf/__pycache__/urls.cpython-311.pyc
+0
-0
views.cpython-311.pyc
...arpas_reading/bookshelf/__pycache__/views.cpython-311.pyc
+0
-0
author_details.html
...reading/bookshelf/templates/bookshelf/author_details.html
+19
-0
authors.html
mattarpas_reading/bookshelf/templates/bookshelf/authors.html
+14
-0
book_details.html
...s_reading/bookshelf/templates/bookshelf/book_details.html
+8
-7
urls.py
mattarpas_reading/bookshelf/urls.py
+4
-2
views.py
mattarpas_reading/bookshelf/views.py
+7
-6
No files found.
mattarpas_reading/bookshelf/__pycache__/urls.cpython-311.pyc
View file @
7c7b071b
No preview for this file type
mattarpas_reading/bookshelf/__pycache__/views.cpython-311.pyc
View file @
7c7b071b
No preview for this file type
mattarpas_reading/bookshelf/templates/bookshelf/author_details.html
0 → 100644
View file @
7c7b071b
{% extends 'base.html' %}
{% load static %}
{% block title %}{{ author }}{% endblock %}
{% block content %}
<h1>
{{ author }}
<br></h1>
<p>
{{ author.age }}
<br></p>
<p>
{{ author.nationality }}
<br></p>
<p>
{{ author.bio }}
<br></p>
<p>
Books by {{ author }} I love:
<br></p>
<ul
style=
"list-style-type:circle"
></ul>
{% for book in booklist %}
<li><a
href=
"{{ book.get_absolute_url }}"
>
{{ book }}
</a></li>
{% endfor %}
<br></ul>
<a
href=
"http://localhost:8000/home/"
>
Home
</a>
<a
href=
"http://localhost:8000/books/"
>
Books
</a>
<a
href=
"http://localhost:8000/authors/"
>
Authors
</a>
{% endblock %}
\ No newline at end of file
mattarpas_reading/bookshelf/templates/bookshelf/authors.html
0 → 100644
View file @
7c7b071b
{% extends 'base.html' %}
{% load static %}
{% block title %}My Favorite Authors{% endblock %}
{% block content %}
<h1>
Matt's Favorite Authors:
<br><br></h1>
<ul
style=
"list-style-type:circle"
>
{% for author in authors %}
<li><a
href=
"{{ author.get_absolute_url }}"
>
{{ author.first_name }}
{{ author.last_name }}
</a></li>
{% endfor %}
</ul>
<a
href=
"http://localhost:8000/home/"
>
Home
</a>
<a
href=
"http://localhost:8000/books/"
>
Books
</a>
{% endblock %}
\ No newline at end of file
mattarpas_reading/bookshelf/templates/bookshelf/book_details.html
View file @
7c7b071b
{% extends 'base.html' %}
{% extends 'base.html' %}
{% load static %}
{% load static %}
{% block title %}
My Favorite Books
{% endblock %}
{% block title %}
{{ book.title }}
{% endblock %}
{% block content %}
{% block content %}
<h1>
Matt's Favorite Books:
<br><br></h1>
<h1>
{{ book.title }}
<br><br></h1>
<
ul
style=
"list-style-type:circle"
>
<
p><a
href=
"{{ book.author.get_absolute_url }}"
>
{{ book.author }}
</a><br></p
>
{% for book in books %}
<p>
{{ book.publisher }}
<br></p>
<li><a
href=
"{{ book.get_absolute_url }}"
>
{{ book.title }}
</a></li
>
<p>
{{ book.year_published }}
<br></p
>
{% endfor %}
<p>
{{ book.ISBN }}
<br></p>
<
/ul
>
<
p>
{{ book.blurb }}
<br><br></p
>
<a
href=
"http://localhost:8000/home/"
>
Home
</a>
<a
href=
"http://localhost:8000/home/"
>
Home
</a>
<a
href=
"http://localhost:8000/books/"
>
Books
</a>
<a
href=
"http://localhost:8000/authors/"
>
Authors
</a>
<a
href=
"http://localhost:8000/authors/"
>
Authors
</a>
{% endblock %}
{% endblock %}
\ No newline at end of file
mattarpas_reading/bookshelf/urls.py
View file @
7c7b071b
from
django.urls
import
path
from
django.urls
import
path
from
.views
import
homepage
,
BooksView
,
BookDetailView
from
.views
import
homepage
,
BooksView
,
BookDetailView
,
AuthorsView
,
AuthorDetailView
urlpatterns
=
[
urlpatterns
=
[
path
(
'home/'
,
homepage
,
name
=
'homepage'
),
path
(
'home/'
,
homepage
,
name
=
'homepage'
),
path
(
'books/'
,
BooksView
.
as_view
(),
name
=
'book-list'
),
path
(
'books/'
,
BooksView
.
as_view
(),
name
=
'book-list'
),
path
(
'books/<int:pk>/details'
,
BookDetailView
.
as_view
(),
name
=
'book-detail'
)
path
(
'books/<int:pk>/details'
,
BookDetailView
.
as_view
(),
name
=
'book-detail'
),
path
(
'authors/'
,
AuthorsView
.
as_view
(),
name
=
'author-list'
),
path
(
'authors/<int:pk>/details'
,
AuthorDetailView
.
as_view
(),
name
=
'author-detail'
),
]
]
app_name
=
"bookshelf"
app_name
=
"bookshelf"
\ No newline at end of file
mattarpas_reading/bookshelf/views.py
View file @
7c7b071b
...
@@ -12,9 +12,9 @@ class BooksView(ListView):
...
@@ -12,9 +12,9 @@ class BooksView(ListView):
return
render
(
request
,
'bookshelf/books.html'
,
{
'books'
:
books
})
return
render
(
request
,
'bookshelf/books.html'
,
{
'books'
:
books
})
class
BookDetailView
(
DetailView
):
class
BookDetailView
(
DetailView
):
def
get
(
self
,
request
):
def
get
(
self
,
request
,
pk
):
books
=
Book
.
objects
.
all
(
)
specificbook
=
Book
.
objects
.
get
(
pk
=
pk
)
return
render
(
request
,
'bookshelf/book_details.html'
,
{
'book
s'
:
books
})
return
render
(
request
,
'bookshelf/book_details.html'
,
{
'book
'
:
specificbook
})
class
AuthorsView
(
ListView
):
class
AuthorsView
(
ListView
):
def
get
(
self
,
request
):
def
get
(
self
,
request
):
...
@@ -22,6 +22,7 @@ class AuthorsView(ListView):
...
@@ -22,6 +22,7 @@ class AuthorsView(ListView):
return
render
(
request
,
'bookshelf/authors.html'
,
{
'authors'
:
authors
})
return
render
(
request
,
'bookshelf/authors.html'
,
{
'authors'
:
authors
})
class
AuthorDetailView
(
DetailView
):
class
AuthorDetailView
(
DetailView
):
def
get
(
self
,
request
):
def
get
(
self
,
request
,
pk
):
authors
=
Author
.
objects
.
all
()
specificauthor
=
Author
.
objects
.
get
(
pk
=
pk
)
return
render
(
request
,
'bookshelf/author_details.html'
,
{
'authors'
:
authors
})
authorbooklist
=
Book
.
objects
.
filter
(
author__exact
=
specificauthor
)
\ No newline at end of file
return
render
(
request
,
'bookshelf/author_details.html'
,
{
'author'
:
specificauthor
,
'booklist'
:
authorbooklist
})
\ 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