Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
anchisilang_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
Anchilla Vera Marie Silang
anchisilang_reading
Commits
9d85de50
Commit
9d85de50
authored
Mar 30, 2023
by
Anchilla Vera Marie Silang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated Views
parent
b2e59bcd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
3 deletions
+34
-3
views.py
anchisilang_reading/bookshelf/views.py
+34
-3
No files found.
anchisilang_reading/bookshelf/views.py
View file @
9d85de50
from
django.http
import
HttpResponse
from
django.shortcuts
import
render
from
django.views.generic
import
ListView
,
DetailView
from
.models
import
*
# Create your views here.
def
index
(
request
):
return
HttpResponse
(
'hello world'
)
\ No newline at end of file
def
Home_Views
(
request
):
return
render
(
request
,
'home.html'
,
{})
class
Books_Views
(
ListView
):
model
=
Book
template_name
=
"books.html"
context_object_name
=
'Books_list'
class
Authors_Views
(
ListView
):
model
=
Author
template_name
=
"authors.html"
context_object_name
=
'Authors_list'
class
Authors_Details_Views
(
DetailView
):
template_name
=
"author_details.html"
model
=
Author
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
Authors_Details_Views
,
self
)
.
get_context_data
(
**
kwargs
)
context
[
'bookdetail'
]
=
Book
.
objects
.
filter
(
author
=
self
.
get_object
())
return
context
class
Book_Details_Views
(
DetailView
):
template_name
=
"book_details.html"
model
=
Book
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
Book_Details_Views
,
self
)
.
get_context_data
(
**
kwargs
)
context
[
'authordetail'
]
=
Author
.
objects
.
filter
(
book
=
self
.
get_object
())
return
context
\ 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