Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
lance_santuyo_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
Lance Dominic B. Santuyo
lance_santuyo_reading
Commits
c3ac4035
Commit
c3ac4035
authored
Mar 29, 2023
by
Lance Dominic B. Santuyo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Created the app-level templates
parent
c19ef4e0
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
102 additions
and
2 deletions
+102
-2
author_detail.html
..._reading/bookshelf/templates/bookshelf/author_detail.html
+20
-0
author_list.html
...yo_reading/bookshelf/templates/bookshelf/author_list.html
+12
-0
books_detail.html
...o_reading/bookshelf/templates/bookshelf/books_detail.html
+19
-0
books_list.html
...uyo_reading/bookshelf/templates/bookshelf/books_list.html
+12
-0
home.html
...e_santuyo_reading/bookshelf/templates/bookshelf/home.html
+12
-0
views.py
lance_santuyo_reading/bookshelf/views.py
+27
-2
No files found.
lance_santuyo_reading/bookshelf/templates/bookshelf/author_detail.html
0 → 100644
View file @
c3ac4035
{% extends 'base.html' %}
{% block title %} {{ author.first_name }} {{ author.last_name }} {% endblock %}
{% block header %} {{ author.first_name }} {{ author.last_name }} {% endblock %}
{% block content %}
<p>
{{ author.age }}
<br>
{{ author.nationality }}
<br>
{{ author.bio }}
<br>
Books by {{ author.first_name }} {{ author.last_name }} I love:
</p>
{% for work in author.works.all %}
<a
href=
"{{ work.get_absolute_url }}"
>
{{ work.title }}
</a>
<br>
{% endfor %}
<br>
<a
href=
"http://127.0.0.1:8000/books/"
>
Books
</a>
<a
href=
"http://127.0.0.1:8000/authors/"
>
Authors
</a>
{% endblock %}
lance_santuyo_reading/bookshelf/templates/bookshelf/author_list.html
0 → 100644
View file @
c3ac4035
{% extends 'base.html' %}
{% block title %} My Favorite Authors {% endblock %}
{% block header %} Lance's Favorite Authors: {% endblock %}
{% block content %}
{% for author in author_list %}
<a
href=
"{{ author.get_absolute_url }}"
>
{{ author.first_name }} {{ author.last_name }}
</a>
<br>
{% endfor %}
<a
href=
"http://127.0.0.1:8000/books/"
>
Books
</a>
<a
href=
"http://127.0.0.1:8000/authors/"
>
Authors
</a>
{% endblock %}
lance_santuyo_reading/bookshelf/templates/bookshelf/books_detail.html
0 → 100644
View file @
c3ac4035
{% extends 'base.html' %}
{% block title %} {{ books.title }} {% endblock %}
{% block header %} {{ books.title }} {% endblock %}
{% block content %}
<p>
{{ books.publisher }}
<br>
<a
href=
"{{ books.author.get_absolute_url }}"
>
{{ books.author.first_name }} {{ books.author.last_name }}
</a>
<br>
{{ books.year_published }}
<br>
{{ books.ISBN }}
<br>
{{ books.blurb }}
<br>
</p>
<a
href=
"http://127.0.0.1:8000/books/"
>
Books
</a>
<a
href=
"http://127.0.0.1:8000/authors/"
>
Authors
</a>
{% endblock %}
lance_santuyo_reading/bookshelf/templates/bookshelf/books_list.html
0 → 100644
View file @
c3ac4035
{% extends 'base.html' %}
{% block title %} My Favorite Books {% endblock %}
{% block header %} Lance's Favorite Books: {% endblock %}
{% block content %}
{% for book in book_list %}
<a
href=
"{{ book.get_absolute_url }}"
>
{{ book.title }}
</a>
<br>
{% endfor %}
<a
href=
"http://127.0.0.1:8000/books/"
>
Books
</a>
<a
href=
"http://127.0.0.1:8000/authors/"
>
Authors
</a>
{% endblock %}
lance_santuyo_reading/bookshelf/templates/bookshelf/home.html
0 → 100644
View file @
c3ac4035
{% extends 'base.html' %}
{% block title %} My Favorite Books
&
Authors {% endblock %}
{% block header %} Welcome to Lance's Database of Favorite Books and Authors! {% endblock %}
{% block content %}
<p>
</p>
<a
href=
"http://127.0.0.1:8000/books/"
>
Books
</a>
<a
href=
"http://127.0.0.1:8000/authors/"
>
Authors
</a>
{% endblock %}
lance_santuyo_reading/bookshelf/views.py
View file @
c3ac4035
from
django.shortcuts
import
render
from
django.shortcuts
import
render
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
from
django.views
import
View
from
django.views.generic.list
import
ListView
from
django.views.generic.detail
import
DetailView
def
index
(
request
):
from
.models
import
Author
,
Books
return
HttpResponse
(
'Hello World! This came from the index view'
)
\ No newline at end of file
class
HomepageView
(
View
):
def
get
(
self
,
request
):
return
render
(
request
,
'bookshelf/home.html'
)
class
BooksPageView
(
ListView
):
model
=
Books
context_object_name
=
'book_list'
class
BooksDetailsView
(
DetailView
):
model
=
Books
class
AuthorsPageView
(
ListView
):
model
=
Author
context_object_name
=
'author_list'
class
AuthorsDetailsView
(
DetailView
):
model
=
Author
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