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
717a9d5f
Commit
717a9d5f
authored
Mar 28, 2023
by
Cheska Hung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
working urls
parent
a37a0dd3
Pipeline
#3044
canceled with stages
Changes
10
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
44 additions
and
10 deletions
+44
-10
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
+5
-4
views.py
bookshelf/views.py
+7
-1
urls.cpython-311.pyc
cheskahung_reading/__pycache__/urls.cpython-311.pyc
+0
-0
urls.py
cheskahung_reading/urls.py
+1
-1
authors.html
templates/authors.html
+4
-1
authors_details.html
templates/authors_details.html
+23
-0
base.html
templates/base.html
+3
-2
books.html
templates/books.html
+1
-1
No files found.
bookshelf/__pycache__/urls.cpython-311.pyc
View file @
717a9d5f
No preview for this file type
bookshelf/__pycache__/views.cpython-311.pyc
View file @
717a9d5f
No preview for this file type
bookshelf/urls.py
View file @
717a9d5f
from
django.urls
import
path
from
django.urls
import
path
from
.
import
views
from
.
import
views
from
.views
import
HomeView
,
BooksListView
,
BooksDetailView
,
AuthorListView
from
.views
import
(
HomeView
,
BooksListView
,
BooksDetailView
,
AuthorListView
,
AuthorDetailView
)
urlpatterns
=
[
urlpatterns
=
[
path
(
''
,
views
.
HomeView
,
name
=
'home'
),
path
(
'
home/
'
,
views
.
HomeView
,
name
=
'home'
),
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
(
'authors/'
,
AuthorListView
.
as_view
(),
name
=
'author'
),
path
(
'
books/<int:pk>/details'
,
Books
DetailView
.
as_view
(),
path
(
'
authors/<int:pk>/details'
,
Author
DetailView
.
as_view
(),
name
=
'
books
-detail'
),
name
=
'
author
-detail'
),
]
]
bookshelf/views.py
View file @
717a9d5f
...
@@ -21,6 +21,12 @@ class BooksDetailView(DetailView):
...
@@ -21,6 +21,12 @@ class BooksDetailView(DetailView):
model
=
Books
model
=
Books
template_name
=
'books_details.html'
template_name
=
'books_details.html'
class
AuthorListView
(
ListView
):
class
AuthorListView
(
ListView
):
model
=
Author
model
=
Author
template_name
=
'authors.html'
template_name
=
'authors.html'
\ No newline at end of file
class
AuthorDetailView
(
DetailView
):
model
=
Author
template_name
=
'authors_details.html'
cheskahung_reading/__pycache__/urls.cpython-311.pyc
View file @
717a9d5f
No preview for this file type
cheskahung_reading/urls.py
View file @
717a9d5f
...
@@ -17,6 +17,6 @@ from django.contrib import admin
...
@@ -17,6 +17,6 @@ from django.contrib import admin
from
django.urls
import
path
,
include
from
django.urls
import
path
,
include
urlpatterns
=
[
urlpatterns
=
[
path
(
'
home/
'
,
include
(
'bookshelf.urls'
,
namespace
=
""
)),
path
(
''
,
include
(
'bookshelf.urls'
,
namespace
=
""
)),
path
(
'admin/'
,
admin
.
site
.
urls
),
path
(
'admin/'
,
admin
.
site
.
urls
),
]
]
templates/authors.html
View file @
717a9d5f
...
@@ -7,9 +7,12 @@
...
@@ -7,9 +7,12 @@
{% for Author in object_list %}
{% for Author in object_list %}
<li>
<li>
<a
href=
"{
{ Author.get_absolute_url }
}"
>
<a
href=
"{
% url 'author-detail' Author.pk %
}"
>
{{Author.first_name}} {{Author.last_name}}
{{Author.first_name}} {{Author.last_name}}
</a>
</a>
</li>
</li>
{% endfor %}
{% endfor %}
{% endblock content %}
{% endblock content %}
\ No newline at end of file
templates/authors_details.html
0 → 100644
View file @
717a9d5f
{% extends "base.html" %}
{% load static %}
{% block content %}
<h1>
{{object.first_name}}{{object.last_name}}
</h1>
<h2>
{{object.age}}
</h2>
<h2>
{{object.nationality}}
</h2>
<h2>
{{object.bio}}
</h2>
{% for Books in object_list %}
<li>
<a
href=
"{{ Books.get_absolute_url }}"
>
{{Books.title}}
</a>
</li>
{% endfor %}
{% endblock content %}
\ No newline at end of file
templates/base.html
View file @
717a9d5f
...
@@ -5,8 +5,9 @@
...
@@ -5,8 +5,9 @@
{% block content %}
{% block content %}
{% endblock content %}
<br>
{% endblock content %}
<br>
<a
href=
"books"
>
Books
</a>
<a
href=
"/books"
>
Books
</a>
<a
href=
"authors"
>
authors
</a>
<a
href=
"/authors"
>
authors
</a>
<a
href=
"/home"
>
home
</a>
</body>
</body>
...
...
templates/books.html
View file @
717a9d5f
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
{% block content %}
{% block content %}
{% for Books in object_list %}
{% for Books in object_list %}
<li>
<li>
<a
href=
"{
{ Books.get_absolute_url }
}"
>
<a
href=
"{
% url 'books-detail' Books.pk %
}"
>
{{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