Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gabigarrero_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
Gabriel G. Garrero
gabigarrero_reading
Commits
c21824e5
Commit
c21824e5
authored
Apr 25, 2023
by
Gabriel G. Garrero
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Edited urls.py and views.py to account for the add book function
parent
d027a198
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletion
+8
-1
urls.py
gabigarrero_reading/bookshelf/urls.py
+2
-1
views.py
gabigarrero_reading/bookshelf/views.py
+6
-0
No files found.
gabigarrero_reading/bookshelf/urls.py
View file @
c21824e5
from
django.urls
import
path
from
.views
import
(
home
,
BooksListView
,
BooksDetailView
,
home
,
BooksListView
,
BooksDetailView
,
BooksCreateView
,
AuthorListView
,
AuthorDetailView
)
...
...
@@ -8,6 +8,7 @@ urlpatterns = [
path
(
'home/'
,
home
,
name
=
'home'
),
path
(
'books/'
,
BooksListView
.
as_view
(),
name
=
'book-list'
),
path
(
'books/<int:pk>/details'
,
BooksDetailView
.
as_view
(),
name
=
'books-details'
),
path
(
'books/add'
,
BooksCreateView
.
as_view
(),
name
=
'add-book'
),
path
(
'authors/'
,
AuthorListView
.
as_view
(),
name
=
'author-list'
),
path
(
'authors/<int:pk>/details'
,
AuthorDetailView
.
as_view
(),
name
=
'author-details'
),
]
...
...
gabigarrero_reading/bookshelf/views.py
View file @
c21824e5
...
...
@@ -2,6 +2,7 @@ from django.shortcuts import render
from
django.views
import
View
from
django.views.generic.list
import
ListView
from
django.views.generic.detail
import
DetailView
from
django.views.generic.edit
import
CreateView
from
.models
import
Author
,
Books
def
home
(
request
):
...
...
@@ -14,6 +15,11 @@ class BooksListView(ListView):
class
BooksDetailView
(
DetailView
):
model
=
Books
template_name
=
'bookshelf/book_details.html'
class
BooksCreateView
(
CreateView
):
model
=
Books
template_name
=
'bookshelf/add-book.html'
fields
=
'__all__'
class
AuthorListView
(
ListView
):
model
=
Author
...
...
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