Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
ejmejilla_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
EJ Mejilla
ejmejilla_reading
Commits
86f3754b
Commit
86f3754b
authored
Apr 25, 2023
by
EJ Mejilla
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Edit Views for Author and Book models
parent
35dca3f6
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
58 additions
and
4 deletions
+58
-4
.gitignore
.gitignore
+2
-0
author_details.html
...reading/bookshelf/templates/bookshelf/author_details.html
+5
-0
book_details.html
...a_reading/bookshelf/templates/bookshelf/book_details.html
+5
-0
edit-author.html
...la_reading/bookshelf/templates/bookshelf/edit-author.html
+21
-0
edit-book.html
...illa_reading/bookshelf/templates/bookshelf/edit-book.html
+21
-0
urls.py
ejmejilla_reading/bookshelf/urls.py
+2
-2
views.py
ejmejilla_reading/bookshelf/views.py
+2
-2
db.sqlite3
ejmejilla_reading/db.sqlite3
+0
-0
No files found.
.gitignore
View file @
86f3754b
lab3env/
lab4env/
.env
db.sqlite3
__pycache__/
ejmejilla_reading/bookshelf/templates/bookshelf/author_details.html
View file @
86f3754b
...
...
@@ -12,6 +12,11 @@
</ul>
</div>
<a
href=
"{% url 'bookshelf:author-update' pk=object.pk %}"
method=
"post"
>
{% csrf_token %}
<input
type=
"submit"
value=
"Edit Author"
>
</a>
<div>
<h2>
Books by {{object.first_name}} {{object.last_name}} I love:
</h2>
<ul>
...
...
ejmejilla_reading/bookshelf/templates/bookshelf/book_details.html
View file @
86f3754b
...
...
@@ -14,6 +14,11 @@
</ul>
</div>
<a
href=
"{% url 'bookshelf:book-update' pk=object.pk %}"
method=
"post"
>
{% csrf_token %}
<input
type=
"submit"
value=
"Edit Book"
>
</a>
<ul
class=
"footer"
>
<li><a
href=
"{% url 'bookshelf:home' %}"
>
Home
</a></li>
<li><a
href=
"{% url 'bookshelf:authors' %}"
>
Authors
</a></li>
...
...
ejmejilla_reading/bookshelf/templates/bookshelf/edit-author.html
0 → 100644
View file @
86f3754b
{% extends 'base.html' %}
{% load static %}
{% block title %} Edit Author {% endblock %}
{% block content %}
<div
class=
"form"
>
<form
action=
""
method=
"post"
>
{% csrf_token %}
<table>
{{ form.as_table }}
</table>
<input
type=
"submit"
value=
"Submit"
/>
</form>
</div>
<ul
class=
"footer"
>
<li><a
href=
"{% url 'bookshelf:home' %}"
>
Home
</a></li>
<li><a
href=
"{% url 'bookshelf:authors' %}"
>
Authors
</a></li>
<li><a
href=
"{% url 'bookshelf:books' %}"
>
Books
</a></li>
</ul>
{% endblock %}
ejmejilla_reading/bookshelf/templates/bookshelf/edit-book.html
0 → 100644
View file @
86f3754b
{% extends 'base.html' %}
{% load static %}
{% block title %} Edit Book {% endblock %}
{% block content %}
<div
class=
"form"
>
<form
action=
""
method=
"post"
>
{% csrf_token %}
<table>
{{ form.as_table }}
</table>
<input
type=
"submit"
value=
"Submit"
/>
</form>
</div>
<ul
class=
"footer"
>
<li><a
href=
"{% url 'bookshelf:home' %}"
>
Home
</a></li>
<li><a
href=
"{% url 'bookshelf:authors' %}"
>
Authors
</a></li>
<li><a
href=
"{% url 'bookshelf:books' %}"
>
Books
</a></li>
</ul>
{% endblock %}
ejmejilla_reading/bookshelf/urls.py
View file @
86f3754b
...
...
@@ -11,11 +11,11 @@ urlpatterns = [
path
(
'books/'
,
BookListView
.
as_view
(),
name
=
'books'
),
path
(
'books/<int:pk>/details/'
,
BookDetailView
.
as_view
(),
name
=
'book-details'
),
path
(
'books/add'
,
BooksCreateView
.
as_view
(),
name
=
'book-create'
),
path
(
'books/<int:pk>'
,
BooksUpdateView
.
as_view
(),
name
=
'book-update'
),
path
(
'books/<int:pk>
/edit/
'
,
BooksUpdateView
.
as_view
(),
name
=
'book-update'
),
path
(
'authors/'
,
AuthorListView
.
as_view
(),
name
=
'authors'
),
path
(
'authors/<int:pk>/details/'
,
AuthorDetailView
.
as_view
(),
name
=
'author-details'
),
path
(
'authors/add'
,
AuthorCreateView
.
as_view
(),
name
=
'author-create'
),
path
(
'authors/<int:pk>
'
,
Books
UpdateView
.
as_view
(),
name
=
'author-update'
),
path
(
'authors/<int:pk>
/edit'
,
Author
UpdateView
.
as_view
(),
name
=
'author-update'
),
]
app_name
=
"bookshelf"
ejmejilla_reading/bookshelf/views.py
View file @
86f3754b
...
...
@@ -40,7 +40,7 @@ class AuthorCreateView(CreateView):
class
AuthorUpdateView
(
UpdateView
):
model
=
Author
fields
=
'__all__'
template_name
=
'
author_details
.html'
template_name
=
'
bookshelf/edit-author
.html'
class
BooksCreateView
(
CreateView
):
...
...
@@ -51,5 +51,5 @@ class BooksCreateView(CreateView):
class
BooksUpdateView
(
UpdateView
):
model
=
Books
fields
=
'__all__'
template_name
=
'book
_details
.html'
template_name
=
'book
shelf/edit-book
.html'
ejmejilla_reading/db.sqlite3
View file @
86f3754b
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