Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
justinreyes_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
Justin Reyes
justinreyes_reading
Commits
4548938f
Commit
4548938f
authored
Apr 24, 2023
by
justin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: added UpdateView for books
parent
2e61b8dd
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
17 additions
and
0 deletions
+17
-0
urls.cpython-310.pyc
...nreyes_reading/bookshelf/__pycache__/urls.cpython-310.pyc
+0
-0
views.cpython-310.pyc
...reyes_reading/bookshelf/__pycache__/views.cpython-310.pyc
+0
-0
edit-book.html
...eyes_reading/bookshelf/templates/bookshelf/edit-book.html
+8
-0
urls.py
justinreyes_reading/bookshelf/urls.py
+2
-0
views.py
justinreyes_reading/bookshelf/views.py
+7
-0
db.sqlite3
justinreyes_reading/db.sqlite3
+0
-0
No files found.
justinreyes_reading/bookshelf/__pycache__/urls.cpython-310.pyc
View file @
4548938f
No preview for this file type
justinreyes_reading/bookshelf/__pycache__/views.cpython-310.pyc
View file @
4548938f
No preview for this file type
justinreyes_reading/bookshelf/templates/bookshelf/edit-book.html
0 → 100644
View file @
4548938f
{% extends 'base.html' %}
{% block content %}
<form
method=
"post"
>
{% csrf_token %}
{{ form.as_p }}
<input
type=
"submit"
value=
"Update"
/>
</form>
{% endblock %}
justinreyes_reading/bookshelf/urls.py
View file @
4548938f
...
@@ -5,6 +5,7 @@ from .views import (
...
@@ -5,6 +5,7 @@ from .views import (
add_author
,
add_author
,
BookListView
,
BookListView
,
BookDetailView
,
BookDetailView
,
BookUpdateView
,
AuthorListView
,
AuthorListView
,
AuthorDetailView
,
AuthorDetailView
,
)
)
...
@@ -14,6 +15,7 @@ urlpatterns = [
...
@@ -14,6 +15,7 @@ urlpatterns = [
path
(
"books/"
,
BookListView
.
as_view
(),
name
=
"book-list"
),
path
(
"books/"
,
BookListView
.
as_view
(),
name
=
"book-list"
),
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"
,
add_book
,
name
=
"add-book"
),
path
(
"books/add"
,
add_book
,
name
=
"add-book"
),
path
(
"books/<int:pk>/edit"
,
BookUpdateView
.
as_view
(),
name
=
"update-book"
),
path
(
"authors/"
,
AuthorListView
.
as_view
(),
name
=
"author-list"
),
path
(
"authors/"
,
AuthorListView
.
as_view
(),
name
=
"author-list"
),
path
(
"authors/add"
,
add_author
,
name
=
"add-author"
),
path
(
"authors/add"
,
add_author
,
name
=
"add-author"
),
path
(
"authors/<int:pk>/details"
,
AuthorDetailView
.
as_view
(),
name
=
"author-detail"
),
path
(
"authors/<int:pk>/details"
,
AuthorDetailView
.
as_view
(),
name
=
"author-detail"
),
...
...
justinreyes_reading/bookshelf/views.py
View file @
4548938f
...
@@ -2,6 +2,7 @@ from django.shortcuts import render, redirect
...
@@ -2,6 +2,7 @@ from django.shortcuts import render, redirect
from
django.urls
import
reverse
from
django.urls
import
reverse
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
UpdateView
from
.models
import
Author
,
Books
from
.models
import
Author
,
Books
from
.forms
import
AuthorForm
,
BookForm
from
.forms
import
AuthorForm
,
BookForm
...
@@ -50,6 +51,12 @@ class BookDetailView(DetailView):
...
@@ -50,6 +51,12 @@ class BookDetailView(DetailView):
template_name
=
"bookshelf/book_details.html"
template_name
=
"bookshelf/book_details.html"
class
BookUpdateView
(
UpdateView
):
model
=
Books
fields
=
"__all__"
template_name
=
"bookshelf/edit-book.html"
class
AuthorListView
(
ListView
):
class
AuthorListView
(
ListView
):
model
=
Author
model
=
Author
template_name
=
"bookshelf/authors.html"
template_name
=
"bookshelf/authors.html"
...
...
justinreyes_reading/db.sqlite3
View file @
4548938f
No preview for this file type
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