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
069d993a
Commit
069d993a
authored
Apr 25, 2023
by
Christian Louis Olivares
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added edit-author.html file and referenced it in models.py, urls.py, and views.py
parent
ace513a0
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
13 additions
and
3 deletions
+13
-3
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
author_details.html
...reading/bookshelf/templates/bookshelf/author_details.html
+1
-0
book_details.html
...s_reading/bookshelf/templates/bookshelf/book_details.html
+1
-1
edit-author.html
...es_reading/bookshelf/templates/bookshelf/edit-author.html
+0
-0
urls.py
chrisolivares_reading/bookshelf/urls.py
+2
-1
views.py
chrisolivares_reading/bookshelf/views.py
+6
-1
No files found.
chrisolivares_reading/bookshelf/__pycache__/models.cpython-310.pyc
View file @
069d993a
No preview for this file type
chrisolivares_reading/bookshelf/__pycache__/urls.cpython-310.pyc
View file @
069d993a
No preview for this file type
chrisolivares_reading/bookshelf/__pycache__/views.cpython-310.pyc
View file @
069d993a
No preview for this file type
chrisolivares_reading/bookshelf/models.py
View file @
069d993a
...
...
@@ -16,6 +16,9 @@ class Author(models.Model):
def
get_absolute_url
(
self
):
return
reverse
(
'bookshelf:author-detail'
,
kwargs
=
{
'pk'
:
self
.
pk
})
def
get_edit_url
(
self
):
return
reverse
(
'bookshelf:edit-author'
,
kwargs
=
{
'pk'
:
self
.
pk
}
)
class
Book
(
models
.
Model
):
...
...
chrisolivares_reading/bookshelf/templates/bookshelf/author_details.html
View file @
069d993a
...
...
@@ -12,6 +12,7 @@
<ul><ul>
{{object.age}}
</ul></ul>
<ul><ul>
{{object.nationality}}
</ul></ul>
<ul><ul>
{{object.bio}}
</ul></ul>
<ul><button
onclick=
"document.location='{{object.get_edit_url}}'"
>
Edit Book
</button></ul>
{%endblock%}
...
...
chrisolivares_reading/bookshelf/templates/bookshelf/book_details.html
View file @
069d993a
...
...
@@ -12,7 +12,7 @@
<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>
<ul><button
onclick=
"document.location='{{object.get_edit_url}}'"
>
Edit Author
</button></ul>
{% endblock %}
{%block hyperlinks%}
...
...
chrisolivares_reading/bookshelf/templates/bookshelf/edit-author.html
0 → 100644
View file @
069d993a
chrisolivares_reading/bookshelf/urls.py
View file @
069d993a
from
django.urls
import
path
from
.views
import
home_view
,
BookListView
,
AuthorsListView
,
BookDetailsView
,
AuthorDetailsView
,
AddBookView
,
AddAuthorView
,
EditBookView
from
.views
import
home_view
,
BookListView
,
AuthorsListView
,
BookDetailsView
,
AuthorDetailsView
,
AddBookView
,
AddAuthorView
,
EditBookView
,
EditAuthorView
urlpatterns
=
[
path
(
''
,
home_view
,
name
=
"My Favorite Books & Authors"
),
...
...
@@ -15,6 +15,7 @@ urlpatterns = [
path
(
'books/<int:pk>/edit/'
,
EditBookView
.
as_view
(),
name
=
"edit-book"
),
path
(
'authors/add/'
,
AddAuthorView
.
as_view
(),
name
=
"add-author"
),
path
(
'authors/<int:pk>/edit/'
,
EditAuthorView
.
as_view
(),
name
=
"edit-author"
),
]
app_name
=
'bookshelf'
\ No newline at end of file
chrisolivares_reading/bookshelf/views.py
View file @
069d993a
...
...
@@ -48,4 +48,9 @@ class AddAuthorView(CreateView):
class
EditBookView
(
UpdateView
):
model
=
Book
fields
=
'__all__'
template_name
=
'bookshelf/edit-book.html'
\ No newline at end of file
template_name
=
'bookshelf/edit-book.html'
class
EditAuthorView
(
CreateView
):
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