Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cheskahung_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
Cheska Hung
cheskahung_reading
Commits
a37a0dd3
Commit
a37a0dd3
authored
Mar 28, 2023
by
Cheska Hung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
authors page
parent
559ecdc4
Pipeline
#3039
canceled with stages
Changes
6
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
24 additions
and
4 deletions
+24
-4
urls.cpython-311.pyc
bookshelf/__pycache__/urls.cpython-311.pyc
+0
-0
views.cpython-311.pyc
bookshelf/__pycache__/views.cpython-311.pyc
+0
-0
urls.py
bookshelf/urls.py
+4
-1
views.py
bookshelf/views.py
+4
-0
authors.html
templates/authors.html
+15
-0
books.html
templates/books.html
+1
-3
No files found.
bookshelf/__pycache__/urls.cpython-311.pyc
View file @
a37a0dd3
No preview for this file type
bookshelf/__pycache__/views.cpython-311.pyc
View file @
a37a0dd3
No preview for this file type
bookshelf/urls.py
View file @
a37a0dd3
from
django.urls
import
path
from
django.urls
import
path
from
.
import
views
from
.
import
views
from
.views
import
HomeView
,
BooksListView
,
BooksDetailView
from
.views
import
HomeView
,
BooksListView
,
BooksDetailView
,
AuthorListView
urlpatterns
=
[
urlpatterns
=
[
...
@@ -9,6 +9,9 @@ urlpatterns = [
...
@@ -9,6 +9,9 @@ urlpatterns = [
path
(
'books/'
,
BooksListView
.
as_view
(),
name
=
'books'
),
path
(
'books/'
,
BooksListView
.
as_view
(),
name
=
'books'
),
path
(
'books/<int:pk>/details'
,
BooksDetailView
.
as_view
(),
path
(
'books/<int:pk>/details'
,
BooksDetailView
.
as_view
(),
name
=
'books-detail'
),
name
=
'books-detail'
),
path
(
'authors/'
,
AuthorListView
.
as_view
(),
name
=
'author'
),
path
(
'books/<int:pk>/details'
,
BooksDetailView
.
as_view
(),
name
=
'books-detail'
),
]
]
bookshelf/views.py
View file @
a37a0dd3
...
@@ -20,3 +20,7 @@ class BooksListView(ListView):
...
@@ -20,3 +20,7 @@ class BooksListView(ListView):
class
BooksDetailView
(
DetailView
):
class
BooksDetailView
(
DetailView
):
model
=
Books
model
=
Books
template_name
=
'books_details.html'
template_name
=
'books_details.html'
class
AuthorListView
(
ListView
):
model
=
Author
template_name
=
'authors.html'
\ No newline at end of file
templates/authors.html
View file @
a37a0dd3
{% extends "base.html" %}
{% load static %}
{% block content %}
<h1>
Cheska's Favorite Authors:
</h1>
{% for Author in object_list %}
<li>
<a
href=
"{{ Author.get_absolute_url }}"
>
{{Author.first_name}} {{Author.last_name}}
</a>
</li>
{% endfor %}
{% endblock content %}
\ No newline at end of file
templates/books.html
View file @
a37a0dd3
{% extends "base.html" %}
{% extends "base.html" %}
{% load static %}
{% block content %}
{% block content %}
{% for Books in object_list %}
{% for Books in object_list %}
<li>
<li>
<a
href=
"{{ get_absolute_url }}"
>
<a
href=
"{{
Books.
get_absolute_url }}"
>
{{Books.title}}
{{Books.title}}
</a>
</a>
</li>
</li>
...
...
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