Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
albertgagalac_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
Albert Gagalac
albertgagalac_reading
Commits
ebebefef
Commit
ebebefef
authored
Mar 30, 2023
by
Albert Gagalac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented working hyperlinks + finished all pages
parent
32d56472
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
157 additions
and
47 deletions
+157
-47
models.cpython-310.pyc
...alac_reading/bookshelf/__pycache__/models.cpython-310.pyc
+0
-0
urls.cpython-310.pyc
...agalac_reading/bookshelf/__pycache__/urls.cpython-310.pyc
+0
-0
views.cpython-310.pyc
...galac_reading/bookshelf/__pycache__/views.cpython-310.pyc
+0
-0
models.py
...gagalac_reading/albertgagalac_reading/bookshelf/models.py
+6
-3
author.html
...gagalac_reading/bookshelf/templates/bookshelf/author.html
+0
-8
author_detail.html
..._reading/bookshelf/templates/bookshelf/author_detail.html
+16
-0
author_list.html
...ac_reading/bookshelf/templates/bookshelf/author_list.html
+28
-0
book_detail.html
...ac_reading/bookshelf/templates/bookshelf/book_detail.html
+27
-0
book_list.html
...alac_reading/bookshelf/templates/bookshelf/book_list.html
+26
-0
books.html
...tgagalac_reading/bookshelf/templates/bookshelf/books.html
+0
-7
home.html
...rtgagalac_reading/bookshelf/templates/bookshelf/home.html
+27
-3
urls.py
...rtgagalac_reading/albertgagalac_reading/bookshelf/urls.py
+9
-4
views.py
...tgagalac_reading/albertgagalac_reading/bookshelf/views.py
+11
-9
base.html
...gagalac_reading/albertgagalac_reading/templates/base.html
+7
-13
No files found.
albertgagalac_reading/albertgagalac_reading/bookshelf/__pycache__/models.cpython-310.pyc
View file @
ebebefef
No preview for this file type
albertgagalac_reading/albertgagalac_reading/bookshelf/__pycache__/urls.cpython-310.pyc
View file @
ebebefef
No preview for this file type
albertgagalac_reading/albertgagalac_reading/bookshelf/__pycache__/views.cpython-310.pyc
View file @
ebebefef
No preview for this file type
albertgagalac_reading/albertgagalac_reading/bookshelf/models.py
View file @
ebebefef
...
...
@@ -15,11 +15,11 @@ class Author(models.Model):
return
'{} {}'
.
format
(
self
.
first_name
,
self
.
last_name
)
def
get_absolute_url
(
self
):
return
reverse
(
'
author
'
,
kwargs
=
{
'pk'
:
self
.
pk
})
return
reverse
(
'
bookshelf:author-detail
'
,
kwargs
=
{
'pk'
:
self
.
pk
})
class
Book
(
models
.
Model
):
title
=
models
.
CharField
(
default
=
""
,
max_length
=
100
)
author
=
models
.
ForeignKey
(
Author
,
on_delete
=
models
.
CASCADE
)
author
=
models
.
ForeignKey
(
Author
,
on_delete
=
models
.
CASCADE
,
unique
=
True
)
publisher
=
models
.
CharField
(
default
=
""
,
max_length
=
100
)
ISBN
=
models
.
PositiveIntegerField
(
validators
=
[
RegexValidator
(
r'^[0-9]*$'
,
...
...
@@ -31,4 +31,7 @@ class Book(models.Model):
return
'{}'
.
format
(
self
.
title
)
def
get_absolute_url
(
self
):
return
reverse
(
'author'
,
kwargs
=
{
'pk'
:
self
.
pk
})
return
reverse
(
'bookshelf:books-detail'
,
kwargs
=
{
'pk'
:
self
.
pk
})
def
get_home_url
(
self
):
return
reverse
(
'bookshelf:books-list'
)
albertgagalac_reading/albertgagalac_reading/bookshelf/templates/bookshelf/author.html
deleted
100644 → 0
View file @
32d56472
<p>
{{"Widget's Assignments Page"}}
<br><br></p>
{% for data in author %}
<p>
first_name: {{data.first_name}}
<br>
last_name: {{data.last_name}}
<br>
<br>
</p>
{% endfor %}
albertgagalac_reading/albertgagalac_reading/bookshelf/templates/bookshelf/author_detail.html
0 → 100644
View file @
ebebefef
{% extends 'base.html' %}
{% load static %}
{% block css %} {% endblock %}
{% block title %}{{object}}{% endblock %}
{% block heading %}{{object}}{% endblock %}
{% block content %}
<ul>
<h3>
Age:
</h3>
{{object.age}}
<br>
<h3>
Nationality:
</h3>
{{object.nationality}}
<br>
<h3>
Bio:
</h3>
{{object.bio}}
<br><br><br><a
href=
"/home/ "
>
Home
</a>
|
<a
href=
"/books/ "
>
Books
</a>
|
<a
href=
"/author/ "
>
Authors
</a>
</ul>
{% endblock %}
\ No newline at end of file
albertgagalac_reading/albertgagalac_reading/bookshelf/templates/bookshelf/author_list.html
0 → 100644
View file @
ebebefef
{% extends 'base.html' %}
{% load static %}
{% block css %}
h1 {
text-align: center;
padding-top: 175px;
font-family: "Comic Sans MS", cursive;
}
ul {
text-align: center;
font-family: "Arial", cursive;
}
{% endblock %}
{% block title %}My Favorite Authors{% endblock %}
{% block heading %}Burt's Favorite Authors{% endblock %}
{% block content %}
<ul>
{% for object in object_list %}
<a
href=
"{{ object.get_absolute_url }}"
>
{{ object }}
</a>
<br>
{% endfor %}
<br>
<a
href=
"/home/ "
>
Home
</a>
|
<a
href=
"/books/ "
>
Books
</a>
|
<a
href=
"/author/ "
>
Authors
</a>
</ul>
{% endblock %}
\ No newline at end of file
albertgagalac_reading/albertgagalac_reading/bookshelf/templates/bookshelf/book_detail.html
0 → 100644
View file @
ebebefef
{% extends 'base.html' %}
{% load static %}
{% block css %}
h1 {
text-align: center;
padding-top: 175px;
font-family: "Comic Sans MS", cursive;
}
p {
text-align: center;
font-family: "Arial", cursive;
}
{% endblock %}
{% block title %}{{object}}{% endblock %}
{% block heading %}{{object}}{% endblock %}
{% block content %}
<ul>
<h3>
Author:
</h3>
{{object.author}}
<br>
<h3>
Publisher:
</h3>
{{object.publisher}}
<br>
<h3>
ISBN:
</h3>
{{object.ISBN}}
<br>
<h3>
Blurb:
</h3>
{{object.blurb}}
<br><br><br><a
href=
"/home/ "
>
Home
</a>
|
<a
href=
"/books/ "
>
Books
</a>
|
<a
href=
"/author/ "
>
Authors
</a>
</ul>
{% endblock %}
\ No newline at end of file
albertgagalac_reading/albertgagalac_reading/bookshelf/templates/bookshelf/book_list.html
0 → 100644
View file @
ebebefef
{% extends 'base.html' %}
{% load static %}
{% block css %}
h1 {
text-align: center;
padding-top: 175px;
font-family: "Comic Sans MS", cursive;
}
ul {
text-align: center;
font-family: "Arial", cursive;
}
{% endblock %}
{% block title %}My Favorite Books{% endblock %}
{% block heading %}Burt's Favorite Books{% endblock %}
{% block content %}
<ul>
{% for object in object_list %}
<a
href=
"{{ object.get_absolute_url }}"
>
{{object.title}}
</a><br>
{% endfor %}
<br><br>
<a
href=
"/home/ "
>
Home
</a>
|
<a
href=
"/author/"
>
Authors
</a>
</ul>
{% endblock %}
\ No newline at end of file
albertgagalac_reading/albertgagalac_reading/bookshelf/templates/bookshelf/books.html
deleted
100644 → 0
View file @
32d56472
{% extends 'base.html' %}
{% load static %}
{% block heading %}{% endblock %}
{% block content %}
<h1>
Hello World. This is the content
</h1>
{% endblock %}
\ No newline at end of file
albertgagalac_reading/albertgagalac_reading/bookshelf/templates/bookshelf/home.html
View file @
ebebefef
{% extends "base.html" %}
{% load static %}
{% comment %} {% block %} {% endblock %} {% endcomment %}
{% comment %} {% block css %}
<style>
h1
{
text-align
:
center
;
padding-top
:
175px
;
}
p
{
text-align
:
center
;
}
</style>
{% endblock %} {% endcomment %}
{% block css %}
h1 {
text-align: center;
padding-top: 175px;
font-family: "Comic Sans MS", cursive;
}
p {
text-align: center;
font-family: "Arial", cursive;
}
{% endblock %}
{% block title %} My Favorite Books and Authors {% endblock %}
{% block heading %} Welcome to
<br>
Burt's Database
<br>
of Favorite Books and Authors {% endblock %}
{% block content %} In the past I used to be an avid reader of
<br>
Sci-Fi and Mythology type novels. In more recent times,
<br>
I have come to love more manga that deal with
<br>
down-to-earth and realistic themes.
<br>
<br>
tl;dr: I now weeb
<br>
<br>
<br>
Books | Authors
<a
href=
"/books/ "
>
Books
</a>
|
<a
href=
"/author/"
>
Authors
</a>
{% endblock %}
{% block list %} {% endblock %}
\ No newline at end of file
albertgagalac_reading/albertgagalac_reading/bookshelf/urls.py
View file @
ebebefef
from
django.urls
import
path
from
.views
import
author
,
BookPageView
,
home
from
.views
import
(
AuthorDetailView
,
BookDetailView
,
home
,
BookListView
,
AuthorListView
)
urlpatterns
=
[
path
(
''
,
home
,
name
=
'home'
),
path
(
"author/"
,
author
,
name
=
"author"
),
path
(
"books/"
,
BookPageView
.
as_view
(),
name
=
"books"
),
path
(
'home/'
,
home
,
name
=
'home'
),
path
(
"author/"
,
AuthorListView
.
as_view
(),
name
=
"author-list"
),
path
(
"books/"
,
BookListView
.
as_view
(),
name
=
"books-list"
),
path
(
"books/<int:pk>/details"
,
BookDetailView
.
as_view
(),
name
=
"books-detail"
),
path
(
"author/<int:pk>/details"
,
AuthorDetailView
.
as_view
(),
name
=
"author-detail"
),
]
app_name
=
"bookshelf"
\ No newline at end of file
albertgagalac_reading/albertgagalac_reading/bookshelf/views.py
View file @
ebebefef
...
...
@@ -5,17 +5,19 @@ from django.views.generic.detail import DetailView
from
.models
import
Author
,
Book
# Create your views here.
def
home
(
request
):
return
render
(
request
,
'bookshelf/home.html'
)
def
author
(
request
):
author
=
Author
.
objects
.
all
()
return
render
(
request
,
'bookshelf/author.html'
,
{
'author'
:
author
})
class
BookDetailView
(
DetailView
):
model
=
Book
class
AuthorDetailView
(
DetailView
):
model
=
Author
class
BookListView
(
ListView
):
model
=
Book
class
BookPageView
(
View
):
def
get
(
self
,
request
):
books
=
Book
.
objects
.
order_by
(
'title'
)
return
render
(
request
,
'bookshelf/books.html'
,
{
'books'
:
books
})
class
AuthorListView
(
ListView
):
model
=
Author
albertgagalac_reading/albertgagalac_reading/templates/base.html
View file @
ebebefef
...
...
@@ -2,25 +2,19 @@
<html
lang=
"en"
>
<head>
<style>
h1
{
text-align
:
center
;
padding-top
:
175px
;
}
p
{
text-align
:
center
;
}
</style>
<style>
{
%
block
css
%
}
body
{
background
:
rgba
(
255
,
207
,
51
,
0.938
);}
{
%
endblock
%
}
</style>
<link
rel=
"stylesheet"
href=
"style.css"
>
<title>
{% block title %}Burt's Book Bemporium{% endblock %}
</title>
{% block styles %}{% endblock %}
</head>
<body>
<h1>
{% block heading %}
{% endblock %}
</h1>
<h1>
{% block heading %}{% endblock %}
</h1>
<div
id=
"content"
>
<p>
{% block content %}{% endblock %}
</p>
</div>
{% block list %}{% endblock %}
{% 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