Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
migs_atienza_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
Migs Atienza
migs_atienza_reading
Commits
ba0b14df
Commit
ba0b14df
authored
Apr 13, 2023
by
Migs Atienza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finished linking books to author_details.html
parent
4cb6eeac
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
1 deletion
+11
-1
models.cpython-39.pyc
...ienza_reading/bookshelf/__pycache__/models.cpython-39.pyc
+0
-0
models.py
migs_atienza_reading/bookshelf/models.py
+4
-0
authors_details.html
...eading/bookshelf/templates/bookshelf/authors_details.html
+7
-1
No files found.
migs_atienza_reading/bookshelf/__pycache__/models.cpython-39.pyc
View file @
ba0b14df
No preview for this file type
migs_atienza_reading/bookshelf/models.py
View file @
ba0b14df
...
@@ -15,6 +15,10 @@ class Author(models.Model):
...
@@ -15,6 +15,10 @@ class Author(models.Model):
def
get_absolute_url
(
self
):
def
get_absolute_url
(
self
):
return
reverse
(
'bookshelf:authors_details'
,
kwargs
=
{
'pk'
:
self
.
pk
})
return
reverse
(
'bookshelf:authors_details'
,
kwargs
=
{
'pk'
:
self
.
pk
})
def
get_author_books
(
self
):
author_books
=
Book
.
objects
.
filter
(
author
=
self
)
return
author_books
class
Book
(
models
.
Model
):
class
Book
(
models
.
Model
):
title
=
models
.
CharField
(
max_length
=
100
)
title
=
models
.
CharField
(
max_length
=
100
)
...
...
migs_atienza_reading/bookshelf/templates/bookshelf/authors_details.html
View file @
ba0b14df
...
@@ -20,7 +20,13 @@
...
@@ -20,7 +20,13 @@
Books by {{ object.first_name }} {{ object.last_name}} I Love:
<br/>
Books by {{ object.first_name }} {{ object.last_name}} I Love:
<br/>
</h2>
</h2>
<ul>
<ul>
{% for object in object.get_author_books %}
<li>
<a
href=
"{{ object.get_absolute_url }}"
>
{{ object.title }}
</a>
</li>
{% endfor %}
</ul>
</ul>
{% endblock %}
{% endblock %}
{% block links %}
{% block links %}
...
...
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