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
edbfde01
Commit
edbfde01
authored
Apr 25, 2023
by
Gabriel G. Garrero
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated urls.py and views.py to account for edit book function
parent
43d2177b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
urls.py
gabigarrero_reading/bookshelf/urls.py
+2
-1
views.py
gabigarrero_reading/bookshelf/views.py
+6
-1
No files found.
gabigarrero_reading/bookshelf/urls.py
View file @
edbfde01
from
django.urls
import
path
from
django.urls
import
path
from
.views
import
(
from
.views
import
(
home
,
BooksListView
,
BooksDetailView
,
BooksCreateView
,
home
,
BooksListView
,
BooksDetailView
,
BooksCreateView
,
BooksUpdateView
,
AuthorListView
,
AuthorDetailView
,
AuthorCreateView
AuthorListView
,
AuthorDetailView
,
AuthorCreateView
)
)
...
@@ -9,6 +9,7 @@ urlpatterns = [
...
@@ -9,6 +9,7 @@ urlpatterns = [
path
(
'books/'
,
BooksListView
.
as_view
(),
name
=
'book-list'
),
path
(
'books/'
,
BooksListView
.
as_view
(),
name
=
'book-list'
),
path
(
'books/<int:pk>/details'
,
BooksDetailView
.
as_view
(),
name
=
'books-details'
),
path
(
'books/<int:pk>/details'
,
BooksDetailView
.
as_view
(),
name
=
'books-details'
),
path
(
'books/add'
,
BooksCreateView
.
as_view
(),
name
=
'add-book'
),
path
(
'books/add'
,
BooksCreateView
.
as_view
(),
name
=
'add-book'
),
path
(
'books/<int:pk>edit'
,
BooksUpdateView
.
as_view
(),
name
=
'edit-book'
),
path
(
'authors/'
,
AuthorListView
.
as_view
(),
name
=
'author-list'
),
path
(
'authors/'
,
AuthorListView
.
as_view
(),
name
=
'author-list'
),
path
(
'authors/<int:pk>/details'
,
AuthorDetailView
.
as_view
(),
name
=
'author-details'
),
path
(
'authors/<int:pk>/details'
,
AuthorDetailView
.
as_view
(),
name
=
'author-details'
),
path
(
'authors/add'
,
AuthorCreateView
.
as_view
(),
name
=
'add-author'
),
path
(
'authors/add'
,
AuthorCreateView
.
as_view
(),
name
=
'add-author'
),
...
...
gabigarrero_reading/bookshelf/views.py
View file @
edbfde01
...
@@ -2,7 +2,7 @@ from django.shortcuts import render
...
@@ -2,7 +2,7 @@ from django.shortcuts import render
from
django.views
import
View
from
django.views
import
View
from
django.views.generic.list
import
ListView
from
django.views.generic.list
import
ListView
from
django.views.generic.detail
import
DetailView
from
django.views.generic.detail
import
DetailView
from
django.views.generic.edit
import
CreateView
from
django.views.generic.edit
import
CreateView
,
UpdateView
from
.models
import
Author
,
Books
from
.models
import
Author
,
Books
def
home
(
request
):
def
home
(
request
):
...
@@ -21,6 +21,11 @@ class BooksCreateView(CreateView):
...
@@ -21,6 +21,11 @@ class BooksCreateView(CreateView):
template_name
=
'bookshelf/add-book.html'
template_name
=
'bookshelf/add-book.html'
fields
=
'__all__'
fields
=
'__all__'
class
BooksUpdateView
(
UpdateView
):
model
=
Books
template_name
=
'bookshelf/edit-book.html'
fields
=
'__all__'
class
AuthorListView
(
ListView
):
class
AuthorListView
(
ListView
):
model
=
Author
model
=
Author
template_name
=
'bookshelf/authors.html'
template_name
=
'bookshelf/authors.html'
...
...
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