Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
rachpurisima_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
Rachel
rachpurisima_reading
Commits
5e90bd32
Commit
5e90bd32
authored
Mar 28, 2023
by
rachbit
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
created templates and implemented html pages
parent
25677754
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
172 additions
and
7 deletions
+172
-7
0003_alter_book_blurb.py
...ima_reading/bookshelf/migrations/0003_alter_book_blurb.py
+19
-0
models.py
rachpurisima_reading/bookshelf/models.py
+1
-1
author_details.html
...reading/bookshelf/templates/bookshelf/author_details.html
+26
-0
authors.html
...risima_reading/bookshelf/templates/bookshelf/authors.html
+21
-0
book_details.html
...a_reading/bookshelf/templates/bookshelf/book_details.html
+22
-0
books.html
...purisima_reading/bookshelf/templates/bookshelf/books.html
+22
-0
home.html
rachpurisima_reading/bookshelf/templates/bookshelf/home.html
+16
-0
urls.py
rachpurisima_reading/bookshelf/urls.py
+8
-3
views.py
rachpurisima_reading/bookshelf/views.py
+22
-2
settings.py
rachpurisima_reading/rachpurisima_reading/settings.py
+1
-1
base.html
rachpurisima_reading/templates/base.html
+14
-0
No files found.
rachpurisima_reading/bookshelf/migrations/0003_alter_book_blurb.py
0 → 100644
View file @
5e90bd32
# Generated by Django 3.2 on 2023-03-28 13:00
import
django.core.validators
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'bookshelf'
,
'0002_auto_20230328_1255'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'book'
,
name
=
'blurb'
,
field
=
models
.
CharField
(
max_length
=
200
,
validators
=
[
django
.
core
.
validators
.
MinLengthValidator
(
100
)]),
),
]
rachpurisima_reading/bookshelf/models.py
View file @
5e90bd32
...
@@ -19,7 +19,7 @@ class Book(models.Model):
...
@@ -19,7 +19,7 @@ class Book(models.Model):
publisher
=
models
.
CharField
(
max_length
=
100
)
publisher
=
models
.
CharField
(
max_length
=
100
)
year_published
=
models
.
CharField
(
max_length
=
4
,
validators
=
[
RegexValidator
(
r'^\d{1,10}$'
)])
year_published
=
models
.
CharField
(
max_length
=
4
,
validators
=
[
RegexValidator
(
r'^\d{1,10}$'
)])
ISBN
=
models
.
CharField
(
primary_key
=
True
,
max_length
=
13
,
validators
=
[
MinLengthValidator
(
13
),
RegexValidator
(
r'^\d{1,10}$'
)])
ISBN
=
models
.
CharField
(
primary_key
=
True
,
max_length
=
13
,
validators
=
[
MinLengthValidator
(
13
),
RegexValidator
(
r'^\d{1,10}$'
)])
blurb
=
models
.
CharField
(
max_length
=
200
)
blurb
=
models
.
CharField
(
max_length
=
200
,
validators
=
[
MinLengthValidator
(
100
)]
)
def
__str__
(
self
):
def
__str__
(
self
):
return
'{}'
.
format
(
self
.
title
)
return
'{}'
.
format
(
self
.
title
)
rachpurisima_reading/bookshelf/templates/bookshelf/author_details.html
0 → 100644
View file @
5e90bd32
{% extends 'base.html' %}
{% load static %}
{% block title %}{{object.first_name}}{{object.last_name}}{% endblock %}
{% block content %}
<h1>
{{object.title}}
</h1>
<ul>
<li>
{{object.age}}
</li>
<li>
{{object.nationality}}
</li>
<li>
{{object.bio}}
</li>
</ul>
<br>
<h2>
Books by {{object.first_name}} {{object.last_name}} that I love:
</h2>
<ul>
{% for book in object.books.all %}
<li>
<a
href=
"{{ book.get_absolute_url }}"
>
{{book.title}}
</a>
</li>
{% endfor %}
</ul>
<div
class=
"container space-evenly"
>
<a
href=
"/home"
>
Home
</a>
<a
href=
"/books"
>
Books
</a>
<a
href=
"/authors"
>
Authors
</a>
</div>
{% endblock %}
rachpurisima_reading/bookshelf/templates/bookshelf/authors.html
0 → 100644
View file @
5e90bd32
{% extends 'base.html' %}
{% load static %}
{% block title %}My Favorite Authors{% endblock %}
{% block content %}
<h1
class=
"text-center"
>
Rach's Favorite Authors:
</h1>
<br>
<ul>
{% for object in object_list %}
<li>
<a
href=
"{{ object.get_absolute_url }}"
>
{{ object.first_name }}{{ object.last_name }}
</a>
</li>
{% endfor %}
</ul>
<div
class=
"container space-evenly"
>
<a
href=
"/home"
>
Home
</a>
<a
href=
"/books"
>
Books
</a>
</div>
{% endblock %}
rachpurisima_reading/bookshelf/templates/bookshelf/book_details.html
0 → 100644
View file @
5e90bd32
{% extends 'base.html' %}
{% load static %}
{% block title %}{{object.title}}{% endblock %}
{% block content %}
<h1>
{{object.title}}
</h1>
<ul>
<li>
<a
href=
"{{ object.author.get_absolute_url }}"
>
{{object.author}}
</a>
</li>
<li>
{{object.publisher}}
</li>
<li>
{{object.year_published}}
</li>
<li>
{{object.ISBN}}
</li>
<li>
{{object.blurb}}
</li>
</ul>
<br>
<div
class=
"container space-evenly"
>
<a
href=
"/home"
>
Home
</a>
<a
href=
"/books"
>
Books
</a>
<a
href=
"/authors"
>
Authors
</a>
</div>
{% endblock %}
rachpurisima_reading/bookshelf/templates/bookshelf/books.html
0 → 100644
View file @
5e90bd32
{% extends 'base.html' %}
{% load static %}
{% block title %}My Favorite Books{% endblock %}
{% block content %}
<h1
class=
"text-center"
>
Rach's Favorite Books:
</h1>
<br>
<ul>
{% for object in object_list %}
<li>
<a
href=
"{{ object.get_absolute_url }}"
>
{{ object.title }}
</a>
</li>
{% endfor %}
</ul>
<div
class=
"container space-evenly"
>
<a
href=
"/home"
>
Home
</a>
<a
href=
"/authors"
>
Authors
</a>
</div>
{% endblock %}
rachpurisima_reading/bookshelf/templates/bookshelf/home.html
0 → 100644
View file @
5e90bd32
{% extends 'base.html' %}
{% load static %}
{% block title %}My Favorite Books
&
Authors{% endblock %}
{% block content %}
<h1
class=
"text-center"
>
Welcome to Rach's Database of Favorite Books and Authors!
</h1>
<br>
<p
class=
"text-center"
>
!! Book !! Review !! I do not like reading that much but these are some of the books I would like to gatekeep.
</p>
<br>
<div
class=
"container space-evenly"
>
<a
href=
"/books"
>
Books
</a>
<a
href=
"/authors"
>
Authors
</a>
</div>
{% endblock %}
rachpurisima_reading/bookshelf/urls.py
View file @
5e90bd32
from
django.urls
import
path
from
django.urls
import
path
from
.views
import
index
from
.views
import
index
,
home
,
BooksView
,
AuthorsView
,
BookDetailView
,
AuthorDetailView
urlpatterns
=
[
urlpatterns
=
[
path
(
''
,
index
,
name
=
'index'
),
path
(
''
,
index
,
name
=
'index'
),
path
(
'home/'
,
home
,
name
=
'home'
),
path
(
'books/'
,
BooksView
.
as_view
(),
name
=
'books'
),
path
(
'authors/'
,
AuthorsView
.
as_view
(),
name
=
'authors'
),
path
(
'books/<int:pk>/details/'
,
BookDetailView
.
as_view
(),
name
=
'book_details'
),
path
(
'authors/<int:pk>/details/'
,
AuthorDetailView
.
as_view
(),
name
=
'author_details'
)
]
]
# This might be needed, depending on your Django version
app_name
=
"bookshelf"
app_name
=
"bookshelf"
rachpurisima_reading/bookshelf/views.py
View file @
5e90bd32
from
django.shortcuts
import
render
from
django.shortcuts
import
render
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
from
django.views.generic
import
ListView
,
DetailView
# Create your views here.
from
.models
import
Author
,
Book
def
index
(
request
):
def
index
(
request
):
return
HttpResponse
(
'bookshelf view'
)
return
HttpResponse
(
'honk honk'
)
def
home
(
request
):
return
render
(
request
,
'bookshelf/home.html'
,
{
'name'
:
'home'
})
class
BooksView
(
ListView
):
model
=
Book
template_name
=
'bookshelf/books.html'
class
BookDetailView
(
DetailView
):
model
=
Book
template_name
=
'bookshelf/book_details.html'
class
AuthorsView
(
ListView
):
model
=
Author
template_name
=
'bookshelf/authors.html'
class
AuthorDetailView
(
DetailView
):
model
=
Author
template_name
=
'bookshelf/author_details.html'
rachpurisima_reading/rachpurisima_reading/settings.py
View file @
5e90bd32
...
@@ -59,7 +59,7 @@ ROOT_URLCONF = 'rachpurisima_reading.urls'
...
@@ -59,7 +59,7 @@ ROOT_URLCONF = 'rachpurisima_reading.urls'
TEMPLATES
=
[
TEMPLATES
=
[
{
{
'BACKEND'
:
'django.template.backends.django.DjangoTemplates'
,
'BACKEND'
:
'django.template.backends.django.DjangoTemplates'
,
'DIRS'
:
[],
'DIRS'
:
[
os
.
path
.
join
(
BASE_DIR
,
'templates'
)
],
'APP_DIRS'
:
True
,
'APP_DIRS'
:
True
,
'OPTIONS'
:
{
'OPTIONS'
:
{
'context_processors'
:
[
'context_processors'
:
[
...
...
rachpurisima_reading/templates/base.html
0 → 100644
View file @
5e90bd32
<!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>
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