Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
Deokhyun_Lee_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
Deokhyun Lee
Deokhyun_Lee_reading
Commits
43847e19
Commit
43847e19
authored
Apr 25, 2023
by
Deokhyun Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed the url pattern name
parent
75caf9b9
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
13 deletions
+13
-13
forms.py
Deokhyun_Lee_reading/bookshelf/forms.py
+8
-8
urls.py
Deokhyun_Lee_reading/bookshelf/urls.py
+3
-3
views.py
Deokhyun_Lee_reading/bookshelf/views.py
+2
-2
No files found.
Deokhyun_Lee_reading/bookshelf/forms.py
View file @
43847e19
from
django
import
forms
from
django
import
forms
from
.models
import
Author
,
Books
from
.models
import
Books
class
AddBookForm
(
forms
.
Form
):
class
AddBookForm
(
forms
.
Model
Form
):
class
Meta
:
class
Meta
:
model
=
Books
model
=
Books
fields
=
'__all__'
fields
=
'__all__'
def
save
(
self
,
commit
=
True
):
#
def save(self, commit=True):
book
=
super
()
.
save
(
commit
=
False
)
#
book = super().save(commit=False)
# Do any additional processing of the form data here
#
# Do any additional processing of the form data here
if
commit
:
#
if commit:
book
.
save
()
#
book.save()
return
book
#
return book
Deokhyun_Lee_reading/bookshelf/urls.py
View file @
43847e19
...
@@ -6,9 +6,9 @@ urlpatterns = [
...
@@ -6,9 +6,9 @@ urlpatterns = [
path
(
'home/'
,
HomeView
.
as_view
(),
name
=
'home'
),
path
(
'home/'
,
HomeView
.
as_view
(),
name
=
'home'
),
# for Authors page
# for Authors page
path
(
'authors/'
,
AuthorListView
.
as_view
(),
name
=
'authors'
),
path
(
'authors/'
,
AuthorListView
.
as_view
(),
name
=
'authors'
),
path
(
'authors/<int:pk>/details'
,
AuthorDetailView
.
as_view
(),
name
=
'author
-
detail'
),
path
(
'authors/<int:pk>/details'
,
AuthorDetailView
.
as_view
(),
name
=
'author
_
detail'
),
# for Books page
# for Books page
path
(
'books/'
,
BookListView
.
as_view
(),
name
=
'books'
),
path
(
'books/'
,
BookListView
.
as_view
(),
name
=
'books'
),
path
(
'books/<int:pk>/details'
,
BookDetailView
.
as_view
(),
name
=
'book
-
detail'
),
path
(
'books/<int:pk>/details'
,
BookDetailView
.
as_view
(),
name
=
'book
_
detail'
),
path
(
'books/add'
,
BookAddListView
.
as_view
(),
name
=
"add
-
book"
)
path
(
'books/add'
,
BookAddListView
.
as_view
(),
name
=
"add
_
book"
)
]
]
\ No newline at end of file
Deokhyun_Lee_reading/bookshelf/views.py
View file @
43847e19
...
@@ -53,6 +53,6 @@ class BookAddListView(CreateView):
...
@@ -53,6 +53,6 @@ class BookAddListView(CreateView):
# onSave is called, the form will have essential data and this includes pk as well.
# onSave is called, the form will have essential data and this includes pk as well.
new_book
=
form
.
save
()
new_book
=
form
.
save
()
# pass the pk
# pass the pk
return
redirect
(
'
subject_detail
'
,
pk
=
new_book
.
pk
)
return
redirect
(
'
book-details
'
,
pk
=
new_book
.
pk
)
else
:
else
:
return
render
(
request
,
'subject_detail.html'
,
{
'form'
:
form
})
return
render
(
request
,
'book_details.html'
,
{
'form'
:
form
})
\ No newline at end of file
\ 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