Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
fausto_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
Brendan Fausto
fausto_reading
Commits
12ecffad
Commit
12ecffad
authored
Apr 26, 2023
by
Brendan Fausto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed errors in authors and books page, and set up forms for adding new books and authors
parent
798dcd12
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
4 deletions
+17
-4
urls.cpython-311.pyc
reading/bookshelf/__pycache__/urls.cpython-311.pyc
+0
-0
forms.py
reading/bookshelf/forms.py
+13
-0
authors_page.html
reading/bookshelf/templates/bookshelf/authors_page.html
+1
-1
books_page.html
reading/bookshelf/templates/bookshelf/books_page.html
+1
-1
urls.py
reading/bookshelf/urls.py
+2
-2
No files found.
reading/bookshelf/__pycache__/urls.cpython-311.pyc
View file @
12ecffad
No preview for this file type
reading/bookshelf/forms.py
0 → 100644
View file @
12ecffad
from
django.forms
import
ModelForm
from
bookshelf.models
import
Books
,
Authors
class
BookForm
(
ModelForm
):
class
Meta
:
model
=
Books
fields
=
[
'title'
,
'author'
,
'year_published'
,
'isbn'
,
'blurb'
]
class
AuthorForm
(
ModelForm
):
class
Meta
:
model
=
Books
fields
=
[
'first_name'
,
'last_name'
,
'age'
,
'nationality'
,
'bio'
]
\ No newline at end of file
reading/bookshelf/templates/bookshelf/authors_page.html
View file @
12ecffad
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
<ul>
<ul>
{% for object in authors %}
{% for object in authors %}
<li>
<li>
<a
href
"{{
object
.
get_absolute_url
}}
"
>
{{ object.first_name }} {{ object.last_name }}
</a>
<a
href
=
"http://127.0.0.1:8000/authors/{{ object.get_absolute_url }}/details
"
>
{{ object.first_name }} {{ object.last_name }}
</a>
</li>
</li>
{% endfor %}
{% endfor %}
</ul>
</ul>
...
...
reading/bookshelf/templates/bookshelf/books_page.html
View file @
12ecffad
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
<ul>
<ul>
{% for object in books %}
{% for object in books %}
<li>
<li>
<a
href
"
http:
//
127
.
0
.
0
.
1:8000
/
books
/{{
object
.
pk
}}
"
>
{{ object.title }}
</a>
<a
href
=
"http://127.0.0.1:8000/books/{{ object.get_absolute_url }}/details
"
>
{{ object.title }}
</a>
</li>
</li>
{% endfor %}
{% endfor %}
</ul>
</ul>
...
...
reading/bookshelf/urls.py
View file @
12ecffad
...
@@ -7,8 +7,8 @@ urlpatterns = [
...
@@ -7,8 +7,8 @@ urlpatterns = [
path
(
'home'
,
home_view
,
name
=
'index'
),
path
(
'home'
,
home_view
,
name
=
'index'
),
path
(
'books'
,
BookListView
.
as_view
(),
name
=
'book-list'
),
path
(
'books'
,
BookListView
.
as_view
(),
name
=
'book-list'
),
path
(
'authors'
,
AuthorListView
.
as_view
(),
name
=
'author-list'
),
path
(
'authors'
,
AuthorListView
.
as_view
(),
name
=
'author-list'
),
path
(
'books/<int:pk>'
,
BookDetailView
.
as_view
(),
name
=
'books-details'
),
path
(
'books/<int:pk>
/details
'
,
BookDetailView
.
as_view
(),
name
=
'books-details'
),
path
(
'authors/<int:pk>'
,
AuthorDetailView
.
as_view
(),
name
=
'authors-details'
),
path
(
'authors/<int:pk>
/details
'
,
AuthorDetailView
.
as_view
(),
name
=
'authors-details'
),
]
]
app_name
=
"bookshelf"
# for proper namespacing in urls, otherwise will result in errors
app_name
=
"bookshelf"
# for proper namespacing in urls, otherwise will result in errors
\ 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