Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
joshbenito_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
Matthew Josh Benedict Benito
joshbenito_reading
Commits
e82d0bf2
Commit
e82d0bf2
authored
May 20, 2023
by
MJoshBen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Created Edit Book and Adjusted the Book Detail Links as well as its corresponding URLs and Views
parent
8eddef72
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
5 deletions
+25
-5
book_details.html
...o_reading/bookshelf/templates/bookshelf/book_details.html
+4
-3
edit-book.html
...nito_reading/bookshelf/templates/bookshelf/edit-book.html
+13
-0
urls.py
joshbenito_reading/bookshelf/urls.py
+2
-1
views.py
joshbenito_reading/bookshelf/views.py
+6
-1
No files found.
joshbenito_reading/bookshelf/templates/bookshelf/book_details.html
View file @
e82d0bf2
...
@@ -10,7 +10,8 @@
...
@@ -10,7 +10,8 @@
{{ book.blurb }}
</h3>
{{ book.blurb }}
</h3>
{% endblock %}
{% endblock %}
{% block scripts %}
{% block scripts %}
<a
href=
"http://127.0.0.1:8000/home"
>
Home
</a>
<a
href=
"/books/{{ book.pk }}/edit"
><input
type=
"submit"
value=
"Edit Book"
></a><br>
<a
href=
"http://127.0.0.1:8000/books"
>
Books
</a>
<a
href=
"/home"
>
Home
</a>
<a
href=
"http://127.0.0.1:8000/authors"
>
Authors
</a>
<a
href=
"/books"
>
Books
</a>
<a
href=
"/authors"
>
Authors
</a>
{% endblock %}
{% endblock %}
joshbenito_reading/bookshelf/templates/bookshelf/edit-book.html
View file @
e82d0bf2
{% extends 'base.html' %}
{% block title %}Edit Book{% endblock %}
{% block content %}
<form
action=
""
method=
"post"
>
{% csrf_token %}
{{ form.as_p }}
<input
type=
"submit"
value=
"Save Changes"
>
</form>
{% endblock %}
{% block scripts %}
{% endblock %}
joshbenito_reading/bookshelf/urls.py
View file @
e82d0bf2
from
django.urls
import
path
from
django.urls
import
path
from
.views
import
homepage_view
,
BooksListView
,
BooksDetailView
,
BooksCreateView
,
AuthorListView
,
AuthorDetailView
,
AuthorCreateView
from
.views
import
homepage_view
,
BooksListView
,
BooksDetailView
,
BooksCreateView
,
BooksUpdateView
,
AuthorListView
,
AuthorDetailView
,
AuthorCreateView
urlpatterns
=
[
urlpatterns
=
[
path
(
'home/'
,
homepage_view
,
name
=
'home'
),
path
(
'home/'
,
homepage_view
,
name
=
'home'
),
path
(
'books/'
,
BooksListView
.
as_view
(),
name
=
'books-list'
),
path
(
'books/'
,
BooksListView
.
as_view
(),
name
=
'books-list'
),
path
(
'books/<int:pk>/details'
,
BooksDetailView
.
as_view
(),
name
=
'book-details'
),
path
(
'books/<int:pk>/details'
,
BooksDetailView
.
as_view
(),
name
=
'book-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
=
'authors-list'
),
path
(
'authors/'
,
AuthorListView
.
as_view
(),
name
=
'authors-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'
)
...
...
joshbenito_reading/bookshelf/views.py
View file @
e82d0bf2
from
django.shortcuts
import
render
from
django.shortcuts
import
render
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
# Create your views here.
# Create your views here.
from
.models
import
Books
,
Author
from
.models
import
Books
,
Author
...
@@ -27,6 +27,11 @@ class BooksCreateView(CreateView):
...
@@ -27,6 +27,11 @@ class BooksCreateView(CreateView):
fields
=
'__all__'
fields
=
'__all__'
template_name
=
'bookshelf/add-book.html'
template_name
=
'bookshelf/add-book.html'
class
BooksUpdateView
(
UpdateView
):
model
=
Books
fields
=
'__all__'
template_name
=
'bookshelf/edit-book.html'
class
AuthorListView
(
ListView
):
class
AuthorListView
(
ListView
):
model
=
Author
model
=
Author
def
get
(
self
,
request
):
def
get
(
self
,
request
):
...
...
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