Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
je_siongco_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
Jose Enrique D. Siongco
je_siongco_reading
Commits
386d5d88
Commit
386d5d88
authored
Apr 25, 2023
by
Jose Enrique D. Siongco
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added edit feature for books and author
parent
c3d35d4d
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
29 additions
and
3 deletions
+29
-3
forms.cpython-311.pyc
...ongco_reading/bookshelf/__pycache__/forms.cpython-311.pyc
+0
-0
urls.cpython-311.pyc
...iongco_reading/bookshelf/__pycache__/urls.cpython-311.pyc
+0
-0
views.cpython-311.pyc
...ongco_reading/bookshelf/__pycache__/views.cpython-311.pyc
+0
-0
urls.py
je_siongco_reading/bookshelf/urls.py
+5
-1
views.py
je_siongco_reading/bookshelf/views.py
+12
-1
db.sqlite3
je_siongco_reading/db.sqlite3
+0
-0
author_details.html
je_siongco_reading/templates/author_details.html
+2
-0
book_details.html
je_siongco_reading/templates/book_details.html
+2
-1
edit-author.html
je_siongco_reading/templates/edit-author.html
+4
-0
edit-book.html
je_siongco_reading/templates/edit-book.html
+4
-0
No files found.
je_siongco_reading/bookshelf/__pycache__/forms.cpython-311.pyc
0 → 100644
View file @
386d5d88
File added
je_siongco_reading/bookshelf/__pycache__/urls.cpython-311.pyc
View file @
386d5d88
No preview for this file type
je_siongco_reading/bookshelf/__pycache__/views.cpython-311.pyc
View file @
386d5d88
No preview for this file type
je_siongco_reading/bookshelf/urls.py
View file @
386d5d88
from
django.urls
import
path
from
.views
import
(
BooksListView
,
BooksDetailView
,
AuthorsDetailView
,
AuthorsListView
,
HomepageView
,
AuthorCreateView
,
BooksCreateView
BooksListView
,
BooksDetailView
,
AuthorsDetailView
,
AuthorsListView
,
HomepageView
,
AuthorCreateView
,
BooksCreateView
,
BooksUpdateView
,
AuthorUpdateView
)
urlpatterns
=
[
...
...
@@ -12,4 +14,6 @@ urlpatterns = [
path
(
'home/'
,
HomepageView
,
name
=
'home'
),
path
(
'authors/add/'
,
AuthorCreateView
.
as_view
(),
name
=
'add-author'
),
path
(
'books/add/'
,
BooksCreateView
.
as_view
(),
name
=
'add-author'
),
path
(
'books/<int:pk>/edit/'
,
BooksUpdateView
.
as_view
(),
name
=
'edit-book'
),
path
(
'authors/<int:pk>/edit/'
,
AuthorUpdateView
.
as_view
(),
name
=
'edit-author'
),
]
je_siongco_reading/bookshelf/views.py
View file @
386d5d88
...
...
@@ -3,7 +3,7 @@ from django.shortcuts import render
from
django.template
import
loader
from
django.views.generic.list
import
ListView
from
django.views.generic.detail
import
DetailView
from
django.views.generic.edit
import
CreateView
from
django.views.generic.edit
import
CreateView
,
UpdateView
from
.models
import
Author
,
Books
...
...
@@ -41,6 +41,17 @@ class BooksCreateView(CreateView):
fields
=
'__all__'
template_name
=
'add-book.html'
class
BooksUpdateView
(
UpdateView
):
model
=
Books
fields
=
'__all__'
template_name
=
"edit-book.html"
class
AuthorUpdateView
(
UpdateView
):
model
=
Author
fields
=
'__all__'
template_name
=
"edit-author.html"
'''
books = Books.objects.filter(author=Author)
extra_context = {'books': books.author.all()}
...
...
je_siongco_reading/db.sqlite3
View file @
386d5d88
No preview for this file type
je_siongco_reading/templates/author_details.html
View file @
386d5d88
...
...
@@ -6,6 +6,8 @@
{% block content %}
{% block body %}
{% endblock %}
<button
type =
"button"
onclick=
"window.location.href='../edit/'"
>
Edit Author
</button>
<a
href=
"/home/"
>
Home
</a>
<a
href=
"/books/"
>
Books
</a>
<a
href=
"/authors/"
>
Authors
</a>
...
...
je_siongco_reading/templates/book_details.html
View file @
386d5d88
...
...
@@ -7,7 +7,8 @@
{% block body %}
{% endblock %}
<button
type =
"button"
onclick=
"window.location.href='../edit/'"
>
Edit Book
</button>
<a
href=
"/home/"
>
Home
</a>
<a
href=
"/books/"
>
Books
</a>
<a
href=
"/authors/"
>
Authors
</a>
...
...
je_siongco_reading/templates/edit-author.html
0 → 100644
View file @
386d5d88
<form
method=
"post"
>
{% csrf_token %}
{{ form.as_p }}
<input
type=
"submit"
value=
"Update"
>
</form>
\ No newline at end of file
je_siongco_reading/templates/edit-book.html
0 → 100644
View file @
386d5d88
<form
method=
"post"
>
{% csrf_token %}
{{ form.as_p }}
<input
type=
"submit"
value=
"Update"
>
</form>
\ 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