Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gabeslimbaga_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
Gabriel Limbaga
gabeslimbaga_reading
Commits
37caf373
Commit
37caf373
authored
Mar 28, 2023
by
Gabriel Limbaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implemented templates
parent
9fe488f7
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
144 additions
and
12 deletions
+144
-12
models.cpython-310.pyc
...baga_reading/bookshelf/__pycache__/models.cpython-310.pyc
+0
-0
urls.cpython-310.pyc
...imbaga_reading/bookshelf/__pycache__/urls.cpython-310.pyc
+0
-0
views.cpython-310.pyc
...mbaga_reading/bookshelf/__pycache__/views.cpython-310.pyc
+0
-0
models.py
gabeslimbaga_reading/bookshelf/models.py
+8
-2
authors.html
...imbaga_reading/bookshelf/templates/bookshelf/authors.html
+22
-0
authors_detail.html
...reading/bookshelf/templates/bookshelf/authors_detail.html
+28
-0
books.html
...slimbaga_reading/bookshelf/templates/bookshelf/books.html
+22
-0
books_detail.html
...a_reading/bookshelf/templates/bookshelf/books_detail.html
+19
-0
home.html
gabeslimbaga_reading/bookshelf/templates/bookshelf/home.html
+15
-0
urls.py
gabeslimbaga_reading/bookshelf/urls.py
+6
-2
views.py
gabeslimbaga_reading/bookshelf/views.py
+22
-4
settings.cpython-310.pyc
...gabeslimbaga_reading/__pycache__/settings.cpython-310.pyc
+0
-0
settings.py
gabeslimbaga_reading/gabeslimbaga_reading/settings.py
+1
-1
base.html
gabeslimbaga_reading/templates/base.html
+1
-3
No files found.
gabeslimbaga_reading/bookshelf/__pycache__/models.cpython-310.pyc
View file @
37caf373
No preview for this file type
gabeslimbaga_reading/bookshelf/__pycache__/urls.cpython-310.pyc
View file @
37caf373
No preview for this file type
gabeslimbaga_reading/bookshelf/__pycache__/views.cpython-310.pyc
View file @
37caf373
No preview for this file type
gabeslimbaga_reading/bookshelf/models.py
View file @
37caf373
from
django.db
import
models
from
django.urls
import
reverse
# Create your models here.
class
Author
(
models
.
Model
):
...
...
@@ -12,6 +12,9 @@ class Author(models.Model):
def
__str__
(
self
):
return
str
(
self
.
first_name
+
' '
+
self
.
last_name
)
def
get_absolute_url
(
self
):
return
reverse
(
'bookshelf:authors-details'
,
kwargs
=
{
'pk'
:
self
.
pk
})
class
Books
(
models
.
Model
):
title
=
models
.
CharField
(
max_length
=
50
)
author
=
models
.
ForeignKey
(
Author
,
on_delete
=
models
.
CASCADE
)
...
...
@@ -21,4 +24,7 @@ class Books(models.Model):
blurb
=
models
.
TextField
(
blank
=
True
)
def
__str__
(
self
):
return
self
.
title
\ No newline at end of file
return
self
.
title
def
get_absolute_url
(
self
):
return
reverse
(
'bookshelf:books-details'
,
kwargs
=
{
'pk'
:
self
.
pk
})
\ No newline at end of file
gabeslimbaga_reading/bookshelf/templates/bookshelf/authors.html
0 → 100644
View file @
37caf373
{% extends 'base.html' %}
{% block title %}My Favorite Authors{% endblock %}
{% block content %}
<h1>
Gabes's Favorite Authors:
</h1>
<ul>
{% for object in object_list %}
<li>
<a
href=
"{{ object.get_absolute_url }}"
>
{{object}}
</a>
</li>
{% endfor %}
</ul>
<a
href=
"/bookshelf/home/"
>
Home
</a>
<a
href=
"/bookshelf/books/"
>
Books
</a>
{% endblock %}
\ No newline at end of file
gabeslimbaga_reading/bookshelf/templates/bookshelf/authors_detail.html
0 → 100644
View file @
37caf373
{% extends 'base.html' %}
{% block title %}{{object}}{% endblock %}
{% block content %}
<h1>
{{ object }}
</h1>
Age: {{object.age}}
<br>
Nationality: {{object.nationality}}
<br>
{{object.bio}}
<br>
Books by {{object}} I love:
<ul>
{% for books in object.books_set.all %}
<li>
<a
href=
"/bookshelf/books/{{books.pk}}/details"
>
{{books.title}}
</a>
</li>
{%endfor%}
</ul>
<a
href=
"/bookshelf/home/"
>
Home
</a>
<a
href=
"/bookshelf/books/"
>
Books
</a>
<a
href=
"/bookshelf/authors/"
>
Authors
</a>
{% endblock %}
\ No newline at end of file
gabeslimbaga_reading/bookshelf/templates/bookshelf/books.html
0 → 100644
View file @
37caf373
{% extends 'base.html' %}
{% block title %}My Favorite Books{% endblock %}
{% block content %}
<h1>
Gabes's Favorite Books:
</h1>
<ul>
{% for object in object_list %}
<li>
<a
href=
"{{ object.get_absolute_url }}"
>
{{object}}
</a>
</li>
{% endfor %}
</ul>
<a
href=
"/bookshelf/home/"
>
Home
</a>
<a
href=
"/bookshelf/authors/"
>
Authors
</a>
{% endblock %}
\ No newline at end of file
gabeslimbaga_reading/bookshelf/templates/bookshelf/books_detail.html
0 → 100644
View file @
37caf373
{% extends 'base.html' %}
{% block title %}{{object}}{% endblock %}
{% block content %}
<h1>
{{ object.title }}
</h1>
Author:
<a
href=
"{{ object.author.get_absolute_url }}"
>
{{object.author}}
</a>
<br>
Publisher: {{object.publisher}}
<br>
Year Published: {{object.year_published}}
<br>
ISBN: {{object.ISBN}}
<br>
{{object.blurb}}
<br>
<a
href=
"/bookshelf/home/"
>
Home
</a>
<a
href=
"/bookshelf/books/"
>
Books
</a>
<a
href=
"/bookshelf/authors/"
>
Authors
</a>
{% endblock %}
\ No newline at end of file
gabeslimbaga_reading/bookshelf/templates/bookshelf/home.html
0 → 100644
View file @
37caf373
{% extends 'base.html' %}
{% block title %}My Favorite Books and Authors{% endblock %}
{% block content%}
<h1>
Welcome to Gabes's Database of Favorite Books and Authors
</h1>
Ever since I started Reading, I have been drawn to fiction and preferred to be wicked away
into fictional worlds. The books by Rick Riordan and J.K. Rowling were among my favorite to read
when I was little. As I grew up, books that had lessons I could use in real life such as the financial insight
given by Rich Dad, Poor Dad by Robert Kiyosaki really gave me more to think about as I started to get older.
<br>
<a
href=
"/bookshelf/books/"
>
Books
</a>
<a
href=
"/bookshelf/authors/"
>
Authors
</a>
{% endblock %}
\ No newline at end of file
gabeslimbaga_reading/bookshelf/urls.py
View file @
37caf373
from
django.urls
import
path
from
.views
import
index
from
.views
import
home
,
BooksListView
,
BooksDetailView
,
AuthorListView
,
AuthorDetailView
urlpatterns
=
[
path
(
''
,
index
,
name
=
"index"
)
path
(
'home/'
,
home
,
name
=
"home"
),
path
(
'books/'
,
BooksListView
.
as_view
(),
name
=
"books-list"
),
path
(
'books/<int:pk>/details/'
,
BooksDetailView
.
as_view
(),
name
=
"books-details"
),
path
(
'authors/'
,
AuthorListView
.
as_view
(),
name
=
'author-list'
),
path
(
'authors/<int:pk>/details/'
,
AuthorDetailView
.
as_view
(),
name
=
"authors-details"
)
]
app_name
=
"bookshelf"
\ No newline at end of file
gabeslimbaga_reading/bookshelf/views.py
View file @
37caf373
from
django.http
import
HttpResponse
from
django.shortcuts
import
render
from
django.views
import
View
from
django.views.generic.list
import
ListView
from
django.views.generic.detail
import
DetailView
from
.models
import
Books
,
Author
# Create your views here.
def
home
(
request
):
return
render
(
request
,
'bookshelf/home.html'
)
class
BooksListView
(
ListView
):
model
=
Books
template_name
=
"bookshelf/books.html/"
# Create your views here.
def
index
(
request
):
return
HttpResponse
(
"hello"
)
\ No newline at end of file
class
BooksDetailView
(
DetailView
):
model
=
Books
template_name
=
"bookshelf/books_detail.html/"
class
AuthorListView
(
ListView
):
model
=
Author
template_name
=
"bookshelf/authors.html/"
class
AuthorDetailView
(
DetailView
):
model
=
Author
template_name
=
"bookshelf/authors_detail.html/"
\ No newline at end of file
gabeslimbaga_reading/gabeslimbaga_reading/__pycache__/settings.cpython-310.pyc
View file @
37caf373
No preview for this file type
gabeslimbaga_reading/gabeslimbaga_reading/settings.py
View file @
37caf373
...
...
@@ -55,7 +55,7 @@ ROOT_URLCONF = 'gabeslimbaga_reading.urls'
TEMPLATES
=
[
{
'BACKEND'
:
'django.template.backends.django.DjangoTemplates'
,
'DIRS'
:
[],
'DIRS'
:
[
BASE_DIR
/
'templates'
],
'APP_DIRS'
:
True
,
'OPTIONS'
:
{
'context_processors'
:
[
...
...
gabeslimbaga_reading/templates/base.html
View file @
37caf373
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<link
rel=
"stylesheet"
href=
"style.css"
>
<title>
{% block title %}My amazing site{% endblock %}
</title>
{% block styles %}{% endblock %}
</head>
<body>
<div
id=
"content"
>
{% block content %}{% endblock %}
</div>
{% block scripts %}{% endblock %}
</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