Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
ciellafrancisco_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
Ciella Francisco
ciellafrancisco_reading
Commits
0ec9f924
Commit
0ec9f924
authored
May 15, 2023
by
Ciella
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated views and URLs
parent
14590bb9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
1 deletion
+30
-1
urls.py
ciellafrancisco_reading/bookshelf/urls.py
+4
-0
views.py
ciellafrancisco_reading/bookshelf/views.py
+26
-1
No files found.
ciellafrancisco_reading/bookshelf/urls.py
View file @
0ec9f924
...
...
@@ -6,8 +6,12 @@ urlpatterns = [
path
(
'home/'
,
home_view
,
name
=
'home_view'
),
path
(
'books/'
,
BooksListView
.
as_view
(),
name
=
'books_list'
),
path
(
'books/<int:pk>/details/'
,
BooksDetailView
.
as_view
(),
name
=
'book_details'
),
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/<int:pk>/details/'
,
AuthorDetailView
.
as_view
(),
name
=
'author_details'
),
path
(
'authors/add/'
,
AuthorCreateView
.
as_view
(),
name
=
'add-author'
),
path
(
'authors/<int:pk>/edit/'
,
AuthorUpdateView
.
as_view
(),
name
=
'edit-author'
),
]
app_name
=
'bookshelf'
\ No newline at end of file
ciellafrancisco_reading/bookshelf/views.py
View file @
0ec9f924
from
django.shortcuts
import
render
from
django.views.generic.detail
import
DetailView
from
django.views.generic.list
import
ListView
from
django.views.generic.edit
import
CreateView
,
UpdateView
from
.models
import
Author
,
Books
...
...
@@ -18,6 +19,18 @@ class AuthorListView(ListView):
template_name
=
'bookshelf/authors.html'
class
AuthorCreateView
(
CreateView
):
model
=
Author
fields
=
"__all__"
template_name
=
'bookshelf/add-author.html'
class
AuthorUpdateView
(
UpdateView
):
model
=
Author
fields
=
'__all__'
template_name
=
'bookshelf/edit-author.html'
class
BooksDetailView
(
DetailView
):
model
=
Books
template_name
=
'bookshelf/book_details.html'
...
...
@@ -25,4 +38,16 @@ class BooksDetailView(DetailView):
class
BooksListView
(
ListView
):
model
=
Books
template_name
=
'bookshelf/books.html'
\ No newline at end of file
template_name
=
'bookshelf/books.html'
class
BooksCreateView
(
CreateView
):
model
=
Books
fields
=
"__all__"
template_name
=
'bookshelf/add-book.html'
class
BooksUpdateView
(
UpdateView
):
model
=
Books
fields
=
'__all__'
template_name
=
'bookshelf/edit-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