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
80d9dc83
Commit
80d9dc83
authored
Apr 25, 2023
by
Jose Enrique D. Siongco
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added add-author view
parent
063e6c85
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
1 deletion
+19
-1
urls.py
je_siongco_reading/bookshelf/urls.py
+2
-1
views.py
je_siongco_reading/bookshelf/views.py
+13
-0
add-author.html
je_siongco_reading/templates/add-author.html
+4
-0
No files found.
je_siongco_reading/bookshelf/urls.py
View file @
80d9dc83
from
django.urls
import
path
from
.views
import
(
BooksListView
,
BooksDetailView
,
AuthorsDetailView
,
AuthorsListView
,
HomepageView
BooksListView
,
BooksDetailView
,
AuthorsDetailView
,
AuthorsListView
,
HomepageView
,
AuthorCreateView
)
urlpatterns
=
[
...
...
@@ -10,4 +10,5 @@ urlpatterns = [
path
(
'authors/'
,
AuthorsListView
.
as_view
(),
name
=
'authors-list'
),
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'
),
]
je_siongco_reading/bookshelf/views.py
View file @
80d9dc83
...
...
@@ -3,8 +3,10 @@ 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
.models
import
Author
,
Books
from
.forms
import
BooksForm
,
AuthorForm
def
HomepageView
(
request
):
...
...
@@ -29,6 +31,17 @@ class AuthorsDetailView(DetailView):
model
=
Author
class
AuthorCreateView
(
CreateView
):
model
=
Author
fields
=
'__all__'
template_name
=
'add-author.html'
class
BooksCreateView
(
CreateView
):
model
=
Books
fields
=
'__all__'
template_name
=
'add-books.html'
'''
books = Books.objects.filter(author=Author)
extra_context = {'books': books.author.all()}
...
...
je_siongco_reading/templates/add-author.html
0 → 100644
View file @
80d9dc83
<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