Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
sharmchua_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
Sharmaine Chua
sharmchua_reading
Commits
597c1efa
Commit
597c1efa
authored
Apr 25, 2023
by
Sharmaine Chua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added the feature to update the author and book
parent
139b0a03
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
52 additions
and
2 deletions
+52
-2
author_details.html
...reading/bookshelf/templates/bookshelf/author_details.html
+5
-0
book_details.html
...a_reading/bookshelf/templates/bookshelf/book_details.html
+5
-0
edit-author.html
...ua_reading/bookshelf/templates/bookshelf/edit-author.html
+14
-0
edit-book.html
...chua_reading/bookshelf/templates/bookshelf/edit-book.html
+14
-0
urls.py
sharmchua_reading/bookshelf/urls.py
+3
-1
views.py
sharmchua_reading/bookshelf/views.py
+11
-1
cavy.jpg
sharmchua_reading/templates/cavy.jpg
+0
-0
No files found.
sharmchua_reading/bookshelf/templates/bookshelf/author_details.html
View file @
597c1efa
...
...
@@ -23,6 +23,11 @@
{% endfor %}
</h3>
<a
href=
"./edit"
>
<button
type=
"button"
><p>
Edit Authors
</p></button>
</a>
<br><br>
{# the links to other html files #}
<center>
<div
class=
"btn"
>
...
...
sharmchua_reading/bookshelf/templates/bookshelf/book_details.html
View file @
597c1efa
...
...
@@ -17,6 +17,11 @@
ISBN: {{ object.ISBN }}
<br>
Blurb: {{ object.blurb }}
<br>
</h3>
<a
href=
"./edit"
>
<button
type=
"button"
><p>
Edit Book
</p></button>
</a>
<br><br>
{# the links to other html files #}
<center>
...
...
sharmchua_reading/bookshelf/templates/bookshelf/edit-author.html
0 → 100644
View file @
597c1efa
{% extends 'base.html' %}
{% load static %}
{% block title %}Edit Author{% endblock %}
{% block content %}
<div
class=
"edit-author"
>
<form
method=
"post"
>
{% csrf_token %}
{{ form.as_p }}
<input
type=
"submit"
value=
"Save"
>
</form>
</div>
{% endblock %}
\ No newline at end of file
sharmchua_reading/bookshelf/templates/bookshelf/edit-book.html
0 → 100644
View file @
597c1efa
{% extends 'base.html' %}
{% load static %}
{% block title %}Edit Book{% endblock %}
{% block content %}
<div
class=
"edit_book"
>
<form
method=
"post"
>
{% csrf_token %}
{{ form.as_p }}
<input
type=
"submit"
value=
"Save"
>
</form>
</div>
{% endblock %}
\ No newline at end of file
sharmchua_reading/bookshelf/urls.py
View file @
597c1efa
...
...
@@ -5,10 +5,12 @@ urlpatterns = [
path
(
'home/'
,
index
,
name
=
'home'
),
path
(
'books/'
,
BooksListView
.
as_view
(),
name
=
'books_list'
),
path
(
'books/<int:pk>/details'
,
BooksDetailView
.
as_view
(),
name
=
'book_details'
),
path
(
'books/add'
,
BooksCreateView
.
as_view
(),
name
=
'create_book'
),
path
(
'books/<int:pk>/edit'
,
BooksUpdateView
.
as_view
(),
name
=
'update_book'
),
path
(
'authors/'
,
AuthorListView
.
as_view
(),
name
=
'author_list'
),
path
(
'authors/<int:pk>/details'
,
AuthorDetailView
.
as_view
(),
name
=
'author_details'
),
path
(
'books/add'
,
BooksCreateView
.
as_view
(),
name
=
'create_book'
),
path
(
'authors/add'
,
AuthorCreateView
.
as_view
(),
name
=
'new_author'
),
path
(
'authors/<int:pk>/edit'
,
AuthorUpdateView
.
as_view
(),
name
=
'update_author'
),
]
app_name
=
'bookshelf'
\ No newline at end of file
sharmchua_reading/bookshelf/views.py
View file @
597c1efa
...
...
@@ -2,7 +2,7 @@ from django.shortcuts import render
from
django.http
import
HttpResponse
,
request
from
django.views
import
View
from
.models
import
Author
,
Books
from
django.views.generic.edit
import
CreateView
from
django.views.generic.edit
import
CreateView
,
UpdateView
from
django.views.generic.list
import
ListView
from
django.views.generic.detail
import
DetailView
...
...
@@ -23,6 +23,11 @@ class BooksCreateView(CreateView):
template_name
=
'bookshelf/add-book.html'
fields
=
'__all__'
class
BooksUpdateView
(
UpdateView
):
model
=
Books
template_name
=
'bookshelf/edit-book.html'
fields
=
'__all__'
class
AuthorListView
(
ListView
):
model
=
Author
template_name
=
'bookshelf/authors.html'
...
...
@@ -34,4 +39,9 @@ class AuthorDetailView(DetailView):
class
AuthorCreateView
(
CreateView
):
model
=
Author
template_name
=
'bookshelf/add-author.html'
fields
=
'__all__'
class
AuthorUpdateView
(
UpdateView
):
model
=
Author
template_name
=
'bookshelf/edit-author.html'
fields
=
'__all__'
\ No newline at end of file
sharmchua_reading/templates/cavy.jpg
0 → 100644
View file @
597c1efa
This diff is collapsed.
Click to expand it.
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