Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nicsdevega_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
Nics De Vega
nicsdevega_reading
Commits
d93d3a6e
Commit
d93d3a6e
authored
Apr 25, 2023
by
Nics De Vega
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Created edit pages for books and authors
parent
afc77108
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
20 additions
and
17 deletions
+20
-17
forms.py
nicsdevega_reading/bookshelf/forms.py
+2
-2
add-author.html
...ega_reading/bookshelf/templates/bookshelf/add-author.html
+1
-1
add-book.html
...evega_reading/bookshelf/templates/bookshelf/add-book.html
+2
-2
author_details.html
...reading/bookshelf/templates/bookshelf/author_details.html
+2
-0
book_details.html
...a_reading/bookshelf/templates/bookshelf/book_details.html
+4
-1
edit-author.html
...ga_reading/bookshelf/templates/bookshelf/edit-author.html
+2
-3
edit-book.html
...vega_reading/bookshelf/templates/bookshelf/edit-book.html
+2
-3
urls.py
nicsdevega_reading/bookshelf/urls.py
+4
-4
views.py
nicsdevega_reading/bookshelf/views.py
+1
-1
No files found.
nicsdevega_reading/bookshelf/forms.py
View file @
d93d3a6e
...
...
@@ -5,10 +5,10 @@ from .models import Book, Author
class
BookForm
(
forms
.
ModelForm
):
class
Meta
:
model
=
Book
fields
=
[
'Title'
,
'Author'
,
'Publisher'
,
'Year Published'
,
'ISBN'
,
'Blurb'
]
fields
=
'__all__'
class
AuthorForm
(
forms
.
ModelForm
):
class
Meta
:
model
=
Author
fields
=
[
'First Name'
,
'Last Name'
,
'Age'
,
'Nationality'
,
'Bio'
]
fields
=
'__all__'
nicsdevega_reading/bookshelf/templates/bookshelf/add-author.html
View file @
d93d3a6e
...
...
@@ -3,7 +3,7 @@
{% block title %}Add New Author{% endblock %}
{% block content %}
<br>
<form
action=
"authors/<int:pk>/details/"
method=
"post"
>
<form
method=
"post"
>
{% csrf_token %}
{% for field in form %}
{{field.label}}:{{field}}
<br><br>
...
...
nicsdevega_reading/bookshelf/templates/bookshelf/add-book.html
View file @
d93d3a6e
...
...
@@ -3,11 +3,11 @@
{% block title %}Add New Book{% endblock %}
{% block content %}
<br>
<form
action=
"books/<int:pk>/details/"
method=
"post"
>
<form
method=
"post"
>
{% csrf_token %}
{% for field in form %}
{{field.label}}:{{field}}
<br><br>
{% endfor %}
<input
type=
"submit"
value=
"Add
b
ook"
>
<input
type=
"submit"
value=
"Add
B
ook"
>
</form>
{% endblock %}
\ No newline at end of file
nicsdevega_reading/bookshelf/templates/bookshelf/author_details.html
View file @
d93d3a6e
...
...
@@ -8,6 +8,8 @@
<li
class=
"list-group-item"
><h4>
{{object.age}}
</h4></li>
<li
class=
"list-group-item"
><h4>
{{object.nationality}}
</h4></li>
<li
class=
"list-group-item"
><p>
{{object.bio}}
</p></li>
<li
class=
"list-group-item"
><a
href=
"/bookshelf/authors/{{object.pk}}/edit"
>
Edit Author
</a></li>
<li
class=
"list-group-item"
><h3>
Books by {{object.first_name}} {{object.last_name}} I love:
</h3></li>
<li
class=
"list-group-item"
>
<ul>
...
...
nicsdevega_reading/bookshelf/templates/bookshelf/book_details.html
View file @
d93d3a6e
...
...
@@ -10,6 +10,9 @@
<li
class=
"list-group-item"
><h4>
{{object.year_published}}
</h4></li>
<li
class=
"list-group-item"
><h4>
{{object.ISBN}}
</h4></li>
<li
class=
"list-group-item"
><p>
{{object.blurb}}
</p></li>
<li
class=
"list-group-item"
><a
href=
"/bookshelf/books/{{object.pk}}/edit"
>
Edit Book
</a></li>
<li
class=
"list-group-item"
>
<h2
class=
"text-center"
>
<small>
...
...
@@ -20,4 +23,4 @@
</h2>
</li>
</ul>
{% endblock %}
\ No newline at end of file
{% endblock %}]
\ No newline at end of file
nicsdevega_reading/bookshelf/templates/bookshelf/edit-author.html
View file @
d93d3a6e
...
...
@@ -3,12 +3,11 @@
{% block title %}Edit Author{% endblock %}
{% block content %}
<br>
<form
action=
"/"
method=
"post"
>
<form
method=
"post"
>
{% csrf_token %}
{% for field in form %}
{{field.label}}:{{field}}
<br><br>
{% endfor %}
<input
type=
"submit"
value=
"S
ubmit
"
>
<input
type=
"submit"
value=
"S
ave Changes
"
>
</form>
{% endblock %}
\ No newline at end of file
nicsdevega_reading/bookshelf/templates/bookshelf/edit-book.html
View file @
d93d3a6e
...
...
@@ -3,12 +3,11 @@
{% block title %}Edit Book{% endblock %}
{% block content %}
<br>
<form
action=
"/"
method=
"post"
>
<form
method=
"post"
>
{% csrf_token %}
{% for field in form %}
{{field.label}}:{{field}}
<br><br>
{% endfor %}
<input
type=
"submit"
value=
"S
ubmit
"
>
<input
type=
"submit"
value=
"S
ave Changes
"
>
</form>
{% endblock %}
\ No newline at end of file
nicsdevega_reading/bookshelf/urls.py
View file @
d93d3a6e
...
...
@@ -11,13 +11,13 @@ urlpatterns = [
path
(
'books/'
,
BooksView
.
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
=
'update
_
book'
),
path
(
'books/add/'
,
BooksCreateView
.
as_view
(),
name
=
'add
-
book'
),
path
(
'books/<int:pk>/edit/'
,
BooksUpdateView
.
as_view
(),
name
=
'update
-
book'
),
path
(
'authors/'
,
AuthorsView
.
as_view
(),
name
=
'authors'
),
path
(
'authors/<int:pk>/details/'
,
AuthorsDetailView
.
as_view
(),
name
=
'author_details'
),
path
(
'authors/add/'
,
AuthorsCreateView
.
as_view
(),
name
=
'add
_
author'
),
path
(
'authors/<int:pk>/edit/'
,
AuthorsUpdateView
.
as_view
(),
name
=
'update
_
author'
),
path
(
'authors/add/'
,
AuthorsCreateView
.
as_view
(),
name
=
'add
-
author'
),
path
(
'authors/<int:pk>/edit/'
,
AuthorsUpdateView
.
as_view
(),
name
=
'update
-
author'
),
]
...
...
nicsdevega_reading/bookshelf/views.py
View file @
d93d3a6e
...
...
@@ -43,6 +43,6 @@ class AuthorsCreateView(CreateView):
template_name
=
"bookshelf/add-author.html"
class
AuthorsUpdateView
(
UpdateView
):
model
=
Book
model
=
Author
fields
=
'__all__'
template_name
=
"bookshelf/edit-author.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