Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
trishamillena_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
Trisha Angel Millena
trishamillena_reading
Commits
9cb3c5b3
Commit
9cb3c5b3
authored
Mar 28, 2023
by
Trisha Angel Millena
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Edited views.py
parent
ab5ed2a1
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
20 additions
and
6 deletions
+20
-6
models.cpython-39.pyc
...llena_reading/bookshelf/__pycache__/models.cpython-39.pyc
+0
-0
urls.cpython-39.pyc
...millena_reading/bookshelf/__pycache__/urls.cpython-39.pyc
+0
-0
views.cpython-39.pyc
...illena_reading/bookshelf/__pycache__/views.cpython-39.pyc
+0
-0
books.html
...amillena_reading/bookshelf/templates/bookshelf/books.html
+12
-2
urls.py
trishamillena_reading/bookshelf/urls.py
+3
-3
views.py
trishamillena_reading/bookshelf/views.py
+5
-1
No files found.
trishamillena_reading/bookshelf/__pycache__/models.cpython-39.pyc
View file @
9cb3c5b3
No preview for this file type
trishamillena_reading/bookshelf/__pycache__/urls.cpython-39.pyc
View file @
9cb3c5b3
No preview for this file type
trishamillena_reading/bookshelf/__pycache__/views.cpython-39.pyc
View file @
9cb3c5b3
No preview for this file type
trishamillena_reading/bookshelf/templates/bookshelf/books.html
View file @
9cb3c5b3
...
@@ -2,8 +2,18 @@
...
@@ -2,8 +2,18 @@
{% load static %}
{% load static %}
{% block title %}{% endblock %}
{% block title %}My Favorite Books{% endblock %}
{% block content %}
{% block content %}
<h1>
Trisha's Favorite Books
</h1>
<ul>
{% for object in object_list %}
<li>
<a
href =
'{{ object.get_absolute_url }}'
>
{{ object.title }}
</a>
</li>
{% endfor %}
</ul>
{% endblock %}
{% endblock %}
\ No newline at end of file
trishamillena_reading/bookshelf/urls.py
View file @
9cb3c5b3
from
django.urls
import
path
from
django.urls
import
path
from
.views
import
(
from
.views
import
(
index
,
BookListView
,
BookDetailView
,
AuthorListView
,
AuthorDetailView
home
,
BookListView
,
BookDetailView
,
AuthorListView
,
AuthorDetailView
)
)
urlpatterns
=
[
urlpatterns
=
[
path
(
'home/'
,
views
.
home
,
name
=
'home'
),
path
(
'home/'
,
home
,
name
=
'home'
),
path
(
'books/'
,
views
.
Books
ListView
.
as_view
(),
name
=
'book-details'
),
path
(
'books/'
,
Book
ListView
.
as_view
(),
name
=
'book-details'
),
path
(
'books/<int:pk>/details'
,
BookDetailView
.
as_view
(),
name
=
'book-details'
),
path
(
'books/<int:pk>/details'
,
BookDetailView
.
as_view
(),
name
=
'book-details'
),
path
(
'authors/'
,
AuthorListView
.
as_view
(),
name
=
'author-list'
),
path
(
'authors/'
,
AuthorListView
.
as_view
(),
name
=
'author-list'
),
path
(
'author/<int:pk>/details'
,
AuthorDetailView
.
as_view
(),
name
=
'author-details'
),
path
(
'author/<int:pk>/details'
,
AuthorDetailView
.
as_view
(),
name
=
'author-details'
),
...
...
trishamillena_reading/bookshelf/views.py
View file @
9cb3c5b3
from
django.shortcuts
import
render
from
django.shortcuts
import
render
from
django.views
import
View
from
django.views
import
View
from
django.views.generic.list
import
ListView
from
django.views.generic.list
import
ListView
from
django.views.generic.deta
t
il
import
DetailView
from
django.views.generic.detail
import
DetailView
from
.models
import
Author
,
Books
from
.models
import
Author
,
Books
# Create your views here.
# Create your views here.
...
@@ -11,12 +11,16 @@ def home(request):
...
@@ -11,12 +11,16 @@ def home(request):
class
BookListView
(
ListView
):
class
BookListView
(
ListView
):
model
=
Books
model
=
Books
template_name
=
'bookshelf/books.html'
class
BookDetailView
(
DetailView
):
class
BookDetailView
(
DetailView
):
model
=
Books
model
=
Books
template_name
=
'bookshelf/book_details.html'
class
AuthorListView
(
ListView
):
class
AuthorListView
(
ListView
):
model
=
Author
model
=
Author
template_name
=
'bookshelf/authors.html'
class
AuthorDetailView
(
DetailView
):
class
AuthorDetailView
(
DetailView
):
model
=
Author
model
=
Author
template_name
=
'bookshelf/author_details.html'
\ 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