Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
chrisolivares_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
Christian Louis Olivares
chrisolivares_reading
Commits
ace513a0
Commit
ace513a0
authored
Apr 25, 2023
by
Christian Louis Olivares
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added edit-bookpage and referenced it on views.py, models.py, and urls.py
parent
73bec87d
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
24 additions
and
12 deletions
+24
-12
models.cpython-310.pyc
...ares_reading/bookshelf/__pycache__/models.cpython-310.pyc
+0
-0
urls.cpython-310.pyc
...ivares_reading/bookshelf/__pycache__/urls.cpython-310.pyc
+0
-0
views.cpython-310.pyc
...vares_reading/bookshelf/__pycache__/views.cpython-310.pyc
+0
-0
models.py
chrisolivares_reading/bookshelf/models.py
+3
-0
book_details.html
...s_reading/bookshelf/templates/bookshelf/book_details.html
+12
-9
edit-book.html
...ares_reading/bookshelf/templates/bookshelf/edit-book.html
+0
-0
urls.py
chrisolivares_reading/bookshelf/urls.py
+2
-1
views.py
chrisolivares_reading/bookshelf/views.py
+7
-2
No files found.
chrisolivares_reading/bookshelf/__pycache__/models.cpython-310.pyc
View file @
ace513a0
No preview for this file type
chrisolivares_reading/bookshelf/__pycache__/urls.cpython-310.pyc
View file @
ace513a0
No preview for this file type
chrisolivares_reading/bookshelf/__pycache__/views.cpython-310.pyc
View file @
ace513a0
No preview for this file type
chrisolivares_reading/bookshelf/models.py
View file @
ace513a0
...
...
@@ -39,4 +39,7 @@ class Book(models.Model):
def
get_absolute_url
(
self
):
return
reverse
(
'bookshelf:book-detail'
,
kwargs
=
{
'pk'
:
self
.
pk
})
def
get_edit_url
(
self
):
return
reverse
(
'bookshelf:edit-book'
,
kwargs
=
{
'pk'
:
self
.
pk
}
)
chrisolivares_reading/bookshelf/templates/bookshelf/book_details.html
View file @
ace513a0
...
...
@@ -6,14 +6,17 @@
{{object.title}}
{% endblock %}
{% block text%}
<ul><a
href=
"{{object.author.get_absolute_url}}"
>
{{object.author}}
</a></ul>
<ul>
{{object.publisher}}
</ul>
<ul>
{{object.year_published}}
</ul>
<ul>
{{object.ISBN}}
</ul>
<ul>
{{object.blurb}}
</ul>
<ul><button
onclick=
"document.location='{{object.get_edit_url}}'"
>
HTML Tutorial
</button></ul>
{% endblock %}
{%block hyperlinks%}
<ul><a
href=
"{{object.author.get_absolute_url}}"
>
{{object.author}}
</a></ul>
<ul>
{{object.publisher}}
</ul>
<ul>
{{object.year_published}}
</ul>
<ul>
{{object.ISBN}}
</ul>
<ul>
{{object.blurb}}
</ul>
<br></br>
<ul><ul><a
href=
"/home"
>
Home
</a>
<a
href=
"/books"
>
Books
</a>
<a
href=
"/authors"
>
Authors
</a></ul></ul>
<ul><ul><a
href=
"/home"
>
Home
</a>
<a
href=
"/books"
>
Books
</a>
<a
href=
"/authors"
>
Authors
</a></ul></ul>
{%endblock%}
\ No newline at end of file
chrisolivares_reading/bookshelf/templates/bookshelf/edit-book.html
0 → 100644
View file @
ace513a0
chrisolivares_reading/bookshelf/urls.py
View file @
ace513a0
from
django.urls
import
path
from
.views
import
home_view
,
BookListView
,
AuthorsListView
,
BookDetailsView
,
AuthorDetailsView
,
AddBookView
,
AddAuthorView
from
.views
import
home_view
,
BookListView
,
AuthorsListView
,
BookDetailsView
,
AuthorDetailsView
,
AddBookView
,
AddAuthorView
,
EditBookView
urlpatterns
=
[
path
(
''
,
home_view
,
name
=
"My Favorite Books & Authors"
),
...
...
@@ -12,6 +12,7 @@ urlpatterns = [
path
(
'authors/<int:pk>/details/'
,
AuthorDetailsView
.
as_view
(),
name
=
"author-detail"
),
path
(
'books/add/'
,
AddBookView
.
as_view
(),
name
=
"add-book"
),
path
(
'books/<int:pk>/edit/'
,
EditBookView
.
as_view
(),
name
=
"edit-book"
),
path
(
'authors/add/'
,
AddAuthorView
.
as_view
(),
name
=
"add-author"
),
]
...
...
chrisolivares_reading/bookshelf/views.py
View file @
ace513a0
...
...
@@ -34,7 +34,6 @@ class AuthorDetailsView(DetailView):
return
context
class
AddBookView
(
CreateView
):
model
=
Book
fields
=
'__all__'
...
...
@@ -43,4 +42,10 @@ class AddBookView(CreateView):
class
AddAuthorView
(
CreateView
):
model
=
Author
fields
=
'__all__'
template_name
=
'bookshelf/add-author.html'
\ No newline at end of file
template_name
=
'bookshelf/add-author.html'
class
EditBookView
(
UpdateView
):
model
=
Book
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