Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
rossybossy_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
Ross Batacan
rossybossy_reading
Commits
372ad12e
Commit
372ad12e
authored
Apr 25, 2023
by
Ross Batacan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added Add Book link on homepage and created add-book.html
parent
b5747190
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
7 deletions
+18
-7
home.html
rossybossy_reading/bookshelf/templates/bookshelf/home.html
+4
-0
urls.py
rossybossy_reading/bookshelf/urls.py
+7
-6
views.py
rossybossy_reading/bookshelf/views.py
+7
-1
No files found.
rossybossy_reading/bookshelf/templates/bookshelf/home.html
View file @
372ad12e
...
...
@@ -7,5 +7,9 @@
<a
href=
"{% url 'bookshelf:books' %}"
>
Books
</a>
&
nbsp
&
nbsp
&
nbsp
&
nbsp
<a
href=
"{% url 'bookshelf:authors' %}"
>
Authors
</a>
&
nbsp
&
nbsp
&
nbsp
&
nbsp
<br>
<br>
<a
href=
"{% url 'bookshelf:book-add' %}"
>
Add Book
</a>
&
nbsp
&
nbsp
&
nbsp
&
nbsp
{% endblock %}
rossybossy_reading/bookshelf/urls.py
View file @
372ad12e
from
django.urls
import
path
from
.
import
views
from
.views
import
BooksListView
,
BooksDetailsView
,
AuthorsListView
,
AuthorDetailsView
from
.views
import
BooksListView
,
BooksDetailsView
,
AuthorsListView
,
AuthorDetailsView
,
BookCreateView
urlpatterns
=
[
path
(
'home/'
,
views
.
home
,
name
=
"home"
),
path
(
'books/'
,
BooksListView
.
as_view
(),
name
=
"books"
),
path
(
'books/<int:pk>/details/'
,
BooksDetailsView
.
as_view
(),
name
=
"book-detail"
),
path
(
'authors/'
,
AuthorsListView
.
as_view
(),
name
=
"authors"
),
path
(
'authors/<int:pk>/details/'
,
AuthorDetailsView
.
as_view
(),
name
=
"author-detail"
),
path
(
'home/'
,
views
.
home
,
name
=
"home"
),
path
(
'books/'
,
BooksListView
.
as_view
(),
name
=
"books"
),
path
(
'books/<int:pk>/details/'
,
BooksDetailsView
.
as_view
(),
name
=
"book-detail"
),
path
(
'authors/'
,
AuthorsListView
.
as_view
(),
name
=
"authors"
),
path
(
'authors/<int:pk>/details/'
,
AuthorDetailsView
.
as_view
(),
name
=
"author-detail"
),
path
(
'books/add'
,
BookCreateView
.
as_view
(),
name
=
'book-add'
)
]
app_name
=
'bookshelf'
rossybossy_reading/bookshelf/views.py
View file @
372ad12e
from
django.shortcuts
import
render
from
django.views.generic.list
import
ListView
from
django.views.generic.detail
import
DetailView
from
django.views.generic.edit
import
CreateView
,
UpdateView
from
.models
import
Author
,
Books
...
...
@@ -24,3 +25,8 @@ class AuthorsListView(ListView):
class
AuthorDetailsView
(
DetailView
):
model
=
Author
template_name
=
'bookshelf/author_details.html'
class
BookCreateView
(
CreateView
):
model
=
Books
fields
=
'__all__'
template_name
=
'bookshelf/add-book.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