Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
rossybossy_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
Ross Batacan
rossybossy_reading
Commits
44333974
Commit
44333974
authored
Apr 25, 2023
by
Ross Batacan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added edit feature on book_details.html and created template edit-book.html
parent
8cb26d91
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
2 deletions
+21
-2
book_details.html
...y_reading/bookshelf/templates/bookshelf/book_details.html
+4
-0
edit-book.html
...ossy_reading/bookshelf/templates/bookshelf/edit-book.html
+9
-0
urls.py
rossybossy_reading/bookshelf/urls.py
+2
-1
views.py
rossybossy_reading/bookshelf/views.py
+6
-1
No files found.
rossybossy_reading/bookshelf/templates/bookshelf/book_details.html
View file @
44333974
...
@@ -11,11 +11,15 @@
...
@@ -11,11 +11,15 @@
{{ books.blurb }}
<br>
{{ books.blurb }}
<br>
</p>
</p>
<a
href=
"{% url 'bookshelf:book-edit' books.id %}"
><button>
Edit
</button></a>
<br><br>
<a
href=
"{% url 'bookshelf:home' %}"
>
Home
</a>
<a
href=
"{% url 'bookshelf:home' %}"
>
Home
</a>
&
nbsp
&
nbsp
&
nbsp
&
nbsp
&
nbsp
&
nbsp
&
nbsp
&
nbsp
<a
href=
"{% url 'bookshelf:books' %}"
>
Books
</a>
<a
href=
"{% url 'bookshelf:books' %}"
>
Books
</a>
&
nbsp
&
nbsp
&
nbsp
&
nbsp
&
nbsp
&
nbsp
&
nbsp
&
nbsp
<a
href=
"{% url 'bookshelf:authors' %}"
>
Authors
</a>
<a
href=
"{% url 'bookshelf:authors' %}"
>
Authors
</a>
{% endblock %}
{% endblock %}
rossybossy_reading/bookshelf/templates/bookshelf/edit-book.html
0 → 100644
View file @
44333974
{% extends 'base.html' %}
{% block title %}Add New Book{% endblock %}
{% block content %}
<form
method=
"POST"
>
{% csrf_token %}
{{ form.as_p }}
<input
type=
"Submit"
value=
"Save Changes"
>
</form>
{% endblock %}
\ No newline at end of file
rossybossy_reading/bookshelf/urls.py
View file @
44333974
from
django.urls
import
path
from
django.urls
import
path
from
.
import
views
from
.
import
views
from
.views
import
BooksListView
,
BooksDetailsView
,
AuthorsListView
,
AuthorDetailsView
,
BookCreateView
,
AuthorCreateView
from
.views
import
BooksListView
,
BooksDetailsView
,
AuthorsListView
,
AuthorDetailsView
,
BookCreateView
,
AuthorCreateView
,
BookEditView
urlpatterns
=
[
urlpatterns
=
[
path
(
'home/'
,
views
.
home
,
name
=
"home"
),
path
(
'home/'
,
views
.
home
,
name
=
"home"
),
...
@@ -11,6 +11,7 @@ urlpatterns = [
...
@@ -11,6 +11,7 @@ urlpatterns = [
path
(
'authors/<int:pk>/details/'
,
AuthorDetailsView
.
as_view
(),
name
=
"author-detail"
),
path
(
'authors/<int:pk>/details/'
,
AuthorDetailsView
.
as_view
(),
name
=
"author-detail"
),
path
(
'books/add'
,
BookCreateView
.
as_view
(),
name
=
'book-add'
),
path
(
'books/add'
,
BookCreateView
.
as_view
(),
name
=
'book-add'
),
path
(
'authors/add'
,
AuthorCreateView
.
as_view
(),
name
=
'author-add'
),
path
(
'authors/add'
,
AuthorCreateView
.
as_view
(),
name
=
'author-add'
),
path
(
'books/<int:pk>/edit/'
,
BookEditView
.
as_view
(),
name
=
'book-edit'
),
]
]
...
...
rossybossy_reading/bookshelf/views.py
View file @
44333974
...
@@ -34,4 +34,9 @@ class BookCreateView(CreateView):
...
@@ -34,4 +34,9 @@ class BookCreateView(CreateView):
class
AuthorCreateView
(
CreateView
):
class
AuthorCreateView
(
CreateView
):
model
=
Author
model
=
Author
fields
=
'__all__'
fields
=
'__all__'
template_name
=
'bookshelf/add-author.html'
template_name
=
'bookshelf/add-author.html'
\ No newline at end of file
class
BookEditView
(
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