Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tanyayotoko_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
Tanya Yotoko
tanyayotoko_reading
Commits
ea85720d
Commit
ea85720d
authored
Apr 25, 2023
by
Tanya Yotoko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Edited urls.py and views.py with the necessary attributes
parent
c3fd9f39
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
1 deletion
+27
-1
urls.py
tanyayotoko_reading/bookshelf/urls.py
+7
-1
views.py
tanyayotoko_reading/bookshelf/views.py
+20
-0
No files found.
tanyayotoko_reading/bookshelf/urls.py
View file @
ea85720d
from
django.urls
import
path
from
.views
import
index
,
homepage
,
BooksView
,
AuthorsView
,
BooksDetailView
,
AuthorsDetailView
from
.views
import
(
index
,
homepage
,
BooksView
,
AuthorsView
,
BooksDetailView
,
AuthorsDetailView
,
BooksCreateView
,
BooksUpdateView
,
AuthorsCreateView
,
AuthorsUpdateView
)
urlpatterns
=
[
path
(
''
,
index
,
name
=
'index'
),
...
...
@@ -8,6 +10,10 @@ urlpatterns = [
path
(
'authors/'
,
AuthorsView
.
as_view
(),
name
=
'authors'
),
path
(
'books/<int:pk>/details/'
,
BooksDetailView
.
as_view
(),
name
=
'book_details'
),
path
(
'authors/<int:pk>/details/'
,
AuthorsDetailView
.
as_view
(),
name
=
'author_details'
),
path
(
'books/add/'
,
BooksCreateView
.
as_view
(),
name
=
'add-book'
),
path
(
'books/<pk>/edit/'
,
BooksUpdateView
.
as_view
(),
name
=
'edit-book'
),
path
(
'authors/add/'
,
AuthorsCreateView
.
as_view
(),
name
=
'add-author'
),
path
(
'authors/<pk>/edit/'
,
AuthorsUpdateView
.
as_view
(),
name
=
'edit-author'
),
]
app_name
=
"bookshelf"
\ No newline at end of file
tanyayotoko_reading/bookshelf/views.py
View file @
ea85720d
...
...
@@ -3,6 +3,7 @@ from django.shortcuts import render
from
.models
import
Author
,
Book
from
django.views.generic.list
import
ListView
from
django.views.generic.detail
import
DetailView
from
django.views.generic.edit
import
CreateView
,
UpdateView
def
index
(
request
):
return
HttpResponse
(
'Hello! This came from the index view'
)
...
...
@@ -18,6 +19,16 @@ class BooksDetailView(DetailView):
model
=
Book
template_name
=
"bookshelf/book_details.html"
class
BooksCreateView
(
CreateView
):
model
=
Book
fields
=
'__all__'
template_name
=
'bookshelf/add-book.html'
class
BooksUpdateView
(
UpdateView
):
model
=
Book
fields
=
'__all__'
template_name
=
'bookshelf/edit-book.html'
class
AuthorsView
(
ListView
):
model
=
Author
template_name
=
"bookshelf/authors.html"
...
...
@@ -26,3 +37,12 @@ class AuthorsDetailView(DetailView):
model
=
Author
template_name
=
"bookshelf/author_details.html"
class
AuthorsCreateView
(
CreateView
):
model
=
Author
fields
=
'__all__'
template_name
=
'bookshelf/add-author.html'
class
AuthorsUpdateView
(
UpdateView
):
model
=
Author
fields
=
'__all__'
template_name
=
'bookshelf/edit-author.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