Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elaizabolislis_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
Elaiza Bolislis
elaizabolislis_reading
Commits
7ecc4213
Commit
7ecc4213
authored
Apr 25, 2023
by
Elaiza Bolislis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Created two new pages that allow the user to edit an existing book and author in the database.
parent
ed8c0499
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
7 deletions
+45
-7
edit-author.html
...is_reading/bookshelf/templates/bookshelf/edit-author.html
+12
-0
edit-book.html
...slis_reading/bookshelf/templates/bookshelf/edit-book.html
+12
-0
urls.py
elaizabolislis_reading/bookshelf/urls.py
+4
-2
views.py
elaizabolislis_reading/bookshelf/views.py
+17
-5
No files found.
elaizabolislis_reading/bookshelf/templates/bookshelf/edit-author.html
0 → 100644
View file @
7ecc4213
{% extends 'base.html' %}
{% load static %}
{% block title %}Edit 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
elaizabolislis_reading/bookshelf/templates/bookshelf/edit-book.html
0 → 100644
View file @
7ecc4213
{% extends 'base.html' %}
{% load static %}
{% block title %}Edit Author{% 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
elaizabolislis_reading/bookshelf/urls.py
View file @
7ecc4213
from
django.urls
import
path
from
.views
import
(
index
,
homepage
,
BooksListView
,
BooksDetailView
,
BooksCreateView
,
AuthorListView
,
AuthorDetailView
,
AuthorCreateView
BooksListView
,
BooksDetailView
,
BooksCreateView
,
BooksUpdateView
,
AuthorListView
,
AuthorDetailView
,
AuthorCreateView
,
AuthorUpdateView
)
urlpatterns
=
[
...
...
@@ -11,10 +11,12 @@ urlpatterns = [
path
(
'books'
,
BooksListView
.
as_view
(),
name
=
'books-list'
),
path
(
'books/<int:pk>/details'
,
BooksDetailView
.
as_view
(),
name
=
'books-detail'
),
path
(
'books/add'
,
BooksCreateView
.
as_view
(),
name
=
'books-create'
),
path
(
'books/<int:pk>/edit'
,
BooksUpdateView
.
as_view
(),
name
=
'books-update'
),
path
(
'authors'
,
AuthorListView
.
as_view
(),
name
=
'author-list'
),
path
(
'authors/<int:pk>/details'
,
AuthorDetailView
.
as_view
(),
name
=
'author-detail'
),
path
(
'authors/add'
,
AuthorCreateView
.
as_view
(),
name
=
'author-create'
),
path
(
'authors/<int:pk>/edit'
,
AuthorUpdateView
.
as_view
(),
name
=
'author-update'
),
]
app_name
=
"bookshelf"
elaizabolislis_reading/bookshelf/views.py
View file @
7ecc4213
...
...
@@ -26,6 +26,18 @@ class BooksDetailView(DetailView):
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'
class
AuthorListView
(
ListView
):
model
=
Author
template_name
=
'bookshelf/authors.html'
...
...
@@ -41,13 +53,13 @@ class AuthorDetailView(DetailView):
return
context
class
Books
CreateView
(
CreateView
):
model
=
Books
class
Author
CreateView
(
CreateView
):
model
=
Author
fields
=
'__all__'
template_name
=
'bookshelf/add-
book
.html'
template_name
=
'bookshelf/add-
author
.html'
class
Author
CreateView
(
Cre
ateView
):
class
Author
UpdateView
(
Upd
ateView
):
model
=
Author
fields
=
'__all__'
template_name
=
'bookshelf/
add
-author.html'
template_name
=
'bookshelf/
edit
-author.html'
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