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
c3d35d4d
Commit
c3d35d4d
authored
Apr 25, 2023
by
Jose Enrique D. Siongco
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added add-book view
parent
80d9dc83
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
3 deletions
+7
-3
urls.py
je_siongco_reading/bookshelf/urls.py
+2
-1
views.py
je_siongco_reading/bookshelf/views.py
+1
-2
add-book.html
je_siongco_reading/templates/add-book.html
+4
-0
No files found.
je_siongco_reading/bookshelf/urls.py
View file @
c3d35d4d
from
django.urls
import
path
from
.views
import
(
BooksListView
,
BooksDetailView
,
AuthorsDetailView
,
AuthorsListView
,
HomepageView
,
AuthorCreateView
BooksListView
,
BooksDetailView
,
AuthorsDetailView
,
AuthorsListView
,
HomepageView
,
AuthorCreateView
,
BooksCreateView
)
urlpatterns
=
[
...
...
@@ -11,4 +11,5 @@ urlpatterns = [
path
(
'authors/<int:pk>/details/'
,
AuthorsDetailView
.
as_view
(),
name
=
'authors-detail'
),
path
(
'home/'
,
HomepageView
,
name
=
'home'
),
path
(
'authors/add/'
,
AuthorCreateView
.
as_view
(),
name
=
'add-author'
),
path
(
'books/add/'
,
BooksCreateView
.
as_view
(),
name
=
'add-author'
),
]
je_siongco_reading/bookshelf/views.py
View file @
c3d35d4d
...
...
@@ -6,7 +6,6 @@ from django.views.generic.detail import DetailView
from
django.views.generic.edit
import
CreateView
from
.models
import
Author
,
Books
from
.forms
import
BooksForm
,
AuthorForm
def
HomepageView
(
request
):
...
...
@@ -40,7 +39,7 @@ class AuthorCreateView(CreateView):
class
BooksCreateView
(
CreateView
):
model
=
Books
fields
=
'__all__'
template_name
=
'add-book
s
.html'
template_name
=
'add-book.html'
'''
books = Books.objects.filter(author=Author)
...
...
je_siongco_reading/templates/add-book.html
0 → 100644
View file @
c3d35d4d
<form
method=
"post"
>
{% csrf_token %}
{{ form.as_p }}
<input
type=
"submit"
value=
"Save"
>
</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