Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jenicavizmanos_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
Jenica Vizmanos
jenicavizmanos_reading
Commits
10c0a92c
Commit
10c0a92c
authored
Apr 25, 2023
by
Jenica Vizmanos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Created forms.py and html files and modified views.py, urls.py, and other existing html files
parent
8114b9e2
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
95 additions
and
6 deletions
+95
-6
forms.py
jenicavizmanos_reading/bookshelf/forms.py
+12
-0
add-author.html
...nos_reading/bookshelf/templates/bookshelf/add-author.html
+11
-0
add-book.html
...manos_reading/bookshelf/templates/bookshelf/add-book.html
+11
-0
author_details.html
...reading/bookshelf/templates/bookshelf/author_details.html
+2
-1
book_details.html
...s_reading/bookshelf/templates/bookshelf/book_details.html
+2
-1
edit-author.html
...os_reading/bookshelf/templates/bookshelf/edit-author.html
+11
-0
edit-book.html
...anos_reading/bookshelf/templates/bookshelf/edit-book.html
+11
-0
home.html
...avizmanos_reading/bookshelf/templates/bookshelf/home.html
+5
-2
urls.py
jenicavizmanos_reading/bookshelf/urls.py
+8
-1
views.py
jenicavizmanos_reading/bookshelf/views.py
+22
-1
No files found.
jenicavizmanos_reading/bookshelf/forms.py
0 → 100644
View file @
10c0a92c
from
django
import
forms
from
.models
import
Author
,
Books
class
AuthorForm
(
forms
.
ModelForm
):
class
Meta
:
model
=
Author
fields
=
'__all__'
class
BooksForm
(
forms
.
ModelForm
):
class
Meta
:
model
=
Books
fields
=
'__all__'
\ No newline at end of file
jenicavizmanos_reading/bookshelf/templates/bookshelf/add-author.html
0 → 100644
View file @
10c0a92c
{% extends 'base.html' %}
{% block title %}Add New Author{% endblock %}
{% block content %}
<form
method=
"post"
>
{% csrf_token %}
{% for field in form %}
{{ field.label }}: {{ field }}
<br><br>
{% endfor %}
<input
type=
"submit"
value=
"Add Author"
>
</form>
{% endblock %}
\ No newline at end of file
jenicavizmanos_reading/bookshelf/templates/bookshelf/add-book.html
0 → 100644
View file @
10c0a92c
{% extends 'base.html' %}
{% block title %}Add New Book{% endblock %}
{% block content %}
<form
method=
"post"
>
{% csrf_token %}
{% for field in form %}
{{ field.label }}: {{ field }}
<br><br>
{% endfor %}
<input
type=
"submit"
value=
"Add Book"
>
</form>
{% endblock %}
\ No newline at end of file
jenicavizmanos_reading/bookshelf/templates/bookshelf/author_details.html
View file @
10c0a92c
...
...
@@ -6,6 +6,7 @@
{{ object.age }}
<br>
{{ object.nationality }}
<br>
{{ object.bio }}
<br><br>
<a
href=
'/bookshelf/authors/{{ object.pk }}/edit/'
>
Edit Author
</a><br><br>
Books by {{ object }} I love:
<ul>
{% for book in object.writings.all %}
...
...
@@ -15,7 +16,7 @@
{% endfor %}
</ul><br><br>
<a
href=
'/bookshelf/home/'
>
Home
</a>
&
nbsp
 
;
<a
href=
'/bookshelf/books/'
>
Books
</a>
<a
href=
'/bookshelf/authors/'
>
Authors
</a>
...
...
jenicavizmanos_reading/bookshelf/templates/bookshelf/book_details.html
View file @
10c0a92c
...
...
@@ -8,8 +8,9 @@
{{ object.year_published }}
<br>
{{ object.ISBN }}
<br>
{{ object.blurb }}
<br><br>
<a
href=
'/bookshelf/books/{{ object.pk }}/edit/'
>
Edit Book
</a><br><br>
<a
href=
'/bookshelf/home/'
>
Home
</a>
&
nbsp
 
;
<a
href=
'/bookshelf/books/'
>
Books
</a>
<a
href=
'/bookshelf/authors/'
>
Authors
</a>
...
...
jenicavizmanos_reading/bookshelf/templates/bookshelf/edit-author.html
0 → 100644
View file @
10c0a92c
{% extends 'base.html' %}
{% block title %}Edit Author{% endblock %}
{% block content %}
<form
method=
"post"
>
{% csrf_token %}
{% for field in form %}
{{ field.label }}: {{ field }}
<br><br>
{% endfor %}
<input
type=
"submit"
value=
"Save Changes"
>
</form>
{% endblock %}
\ No newline at end of file
jenicavizmanos_reading/bookshelf/templates/bookshelf/edit-book.html
0 → 100644
View file @
10c0a92c
{% extends 'base.html' %}
{% block title %}Edit Book{% endblock %}
{% block content %}
<form
method=
"post"
>
{% csrf_token %}
{% for field in form %}
{{ field.label }}: {{ field }}
<br><br>
{% endfor %}
<input
type=
"submit"
value=
"Save Changes"
>
</form>
{% endblock %}
\ No newline at end of file
jenicavizmanos_reading/bookshelf/templates/bookshelf/home.html
View file @
10c0a92c
...
...
@@ -5,7 +5,10 @@
<p>
{{ description }}
<br><br>
<a
href=
'/bookshelf/books/'
>
Books
</a>
&
nbsp
<a
href=
'/bookshelf/authors/'
>
Authors
</a>
<a
href=
'/bookshelf/authors/'
>
Authors
</a><br>
<a
href=
'/bookshelf/books/add/'
>
Add Book
</a>
<a
href=
'/bookshelf/authors/add/'
>
Add Author
</a>
</p>
{% endblock %}
\ No newline at end of file
jenicavizmanos_reading/bookshelf/urls.py
View file @
10c0a92c
from
django.urls
import
path
from
.views
import
home_view
,
AuthorListView
,
AuthorDetailView
,
BooksListView
,
BooksDetailView
from
.views
import
(
home_view
,
AuthorListView
,
AuthorDetailView
,
AuthorCreateView
,
AuthorUpdateView
,
BooksListView
,
BooksDetailView
,
BooksCreateView
,
BooksUpdateView
)
urlpatterns
=
[
path
(
'home/'
,
home_view
,
name
=
'home_view'
),
path
(
'authors/'
,
AuthorListView
.
as_view
(),
name
=
'authors'
),
path
(
'authors/<int:pk>/details/'
,
AuthorDetailView
.
as_view
(),
name
=
'author_details'
),
path
(
'authors/add/'
,
AuthorCreateView
.
as_view
(),
name
=
'add-author'
),
path
(
'authors/<int:pk>/edit/'
,
AuthorUpdateView
.
as_view
(),
name
=
'edit-author'
),
path
(
'books/'
,
BooksListView
.
as_view
(),
name
=
'books'
),
path
(
'books/<int:pk>/details/'
,
BooksDetailView
.
as_view
(),
name
=
'book_details'
),
path
(
'books/add/'
,
BooksCreateView
.
as_view
(),
name
=
'add-book'
),
path
(
'books/<int:pk>/edit/'
,
BooksUpdateView
.
as_view
(),
name
=
'edit-book'
),
]
app_name
=
'bookshelf'
\ No newline at end of file
jenicavizmanos_reading/bookshelf/views.py
View file @
10c0a92c
from
django.shortcuts
import
render
from
django.views.generic.detail
import
DetailView
from
django.views.generic.edit
import
CreateView
,
UpdateView
from
django.views.generic.list
import
ListView
from
.models
import
Author
,
Books
...
...
@@ -17,10 +18,30 @@ class AuthorDetailView(DetailView):
model
=
Author
template_name
=
'bookshelf/author_details.html'
class
AuthorCreateView
(
CreateView
):
model
=
Author
fields
=
'__all__'
template_name
=
'bookshelf/add-author.html'
class
AuthorUpdateView
(
UpdateView
):
model
=
Author
fields
=
'__all__'
template_name
=
'bookshelf/edit-author.html'
class
BooksListView
(
ListView
):
model
=
Books
template_name
=
'bookshelf/books.html'
class
BooksDetailView
(
DetailView
):
model
=
Books
template_name
=
'bookshelf/book_details.html'
\ No newline at end of file
template_name
=
'bookshelf/book_details.html'
class
BooksCreateView
(
CreateView
):
model
=
Books
fields
=
'__all__'
template_name
=
'bookshelf/add-book.html'
class
BooksUpdateView
(
UpdateView
):
model
=
Books
fields
=
'__all__'
template_name
=
'bookshelf/edit-book.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