Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
garethcastillo_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
Gareth Xerxes Yap Castillo
garethcastillo_reading
Commits
5c4f5f85
Commit
5c4f5f85
authored
Apr 25, 2023
by
Gareth Xerxes Yap Castillo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update details html, complete edit htmls, finalize views and urls
parent
10d95ab3
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
39 additions
and
6 deletions
+39
-6
urls.cpython-39.pyc
...astillo_reading/bookshelf/__pycache__/urls.cpython-39.pyc
+0
-0
views.cpython-39.pyc
...stillo_reading/bookshelf/__pycache__/views.cpython-39.pyc
+0
-0
author_details.html
...reading/bookshelf/templates/bookshelf/author_details.html
+2
-0
book_details.html
...o_reading/bookshelf/templates/bookshelf/book_details.html
+1
-0
edit-author.html
...lo_reading/bookshelf/templates/bookshelf/edit-author.html
+11
-1
edit-book.html
...illo_reading/bookshelf/templates/bookshelf/edit-book.html
+11
-1
urls.py
garethcastillo_reading/bookshelf/urls.py
+2
-2
views.py
garethcastillo_reading/bookshelf/views.py
+12
-2
db.sqlite3
garethcastillo_reading/db.sqlite3
+0
-0
No files found.
garethcastillo_reading/bookshelf/__pycache__/urls.cpython-39.pyc
View file @
5c4f5f85
No preview for this file type
garethcastillo_reading/bookshelf/__pycache__/views.cpython-39.pyc
View file @
5c4f5f85
No preview for this file type
garethcastillo_reading/bookshelf/templates/bookshelf/author_details.html
View file @
5c4f5f85
...
...
@@ -10,6 +10,8 @@
{{author.nationality}}
<br
/>
{{author.bio}}
<br
/>
<button
onclick=
"window.location.href='../../../books/{{author.id}}/edit/';"
>
Edit Author
</button>
<br
/>
Books by {{author.first_name}} {{author.last_name}} I love:
<ul>
{% for object in books %}
...
...
garethcastillo_reading/bookshelf/templates/bookshelf/book_details.html
View file @
5c4f5f85
...
...
@@ -12,6 +12,7 @@
{{book.isbn}}
<br
/>
{{book.blurb}}
<br
/>
</p>
<button
onclick=
"window.location.href='../../../books/{{book.id}}/edit/';"
>
Edit Book
</button>
<p
class =
"unaligned_paragraph"
>
<br
/>
<br
/>
...
...
garethcastillo_reading/bookshelf/templates/bookshelf/edit-author.html
View file @
5c4f5f85
{% extends 'base.html' %}
{% load static %}
\ No newline at end of file
{% load static %}
{% block title %}Add New Author{% endblock %}
{% block content %}
<form
method=
"post"
>
{% csrf_token %}
{{form.as_p}}
<input
type =
"submit"
value=
"Save Changes"
>
</form>
{% endblock %}
\ No newline at end of file
garethcastillo_reading/bookshelf/templates/bookshelf/edit-book.html
View file @
5c4f5f85
{% extends 'base.html' %}
{% load static %}
\ No newline at end of file
{% load static %}
{% block title %}Add New Book{% endblock %}
{% block content %}
<form
method=
"post"
>
{% csrf_token %}
{{form.as_p}}
<input
type =
"submit"
value=
"Save Changes"
>
</form>
{% endblock %}
\ No newline at end of file
garethcastillo_reading/bookshelf/urls.py
View file @
5c4f5f85
...
...
@@ -9,8 +9,8 @@ urlpatterns = [
path
(
'authors/<int:author_id>/details/'
,
views
.
authordetails_view
.
as_view
(),
name
=
'author_details'
),
path
(
'books/add'
,
views
.
addbooks_view
.
as_view
(),
name
=
'add_book'
),
path
(
'authors/add'
,
views
.
addauthors_view
.
as_view
(),
name
=
'add_author'
),
#path('books//<int:book_id>/edit/', views_editbook
_view.as_view(), name='edit_book'),
#path('books//<int:author_id>/edit/', views_editauthor
_view.as_view(), name='edit_author'),
path
(
'books/<int:pk>/edit/'
,
views
.
editbooks
_view
.
as_view
(),
name
=
'edit_book'
),
path
(
'books/<int:pk>/edit/'
,
views
.
editauthors
_view
.
as_view
(),
name
=
'edit_author'
),
]
app_name
=
"bookshelf"
\ No newline at end of file
garethcastillo_reading/bookshelf/views.py
View file @
5c4f5f85
from
django.views.generic.edit
import
CreateView
from
django.views.generic.edit
import
CreateView
,
UpdateView
from
django.http
import
HttpResponse
,
Http404
from
django.shortcuts
import
render
from
django.views
import
View
...
...
@@ -48,4 +48,14 @@ class addbooks_view(CreateView):
class
addauthors_view
(
CreateView
):
model
=
Author
fields
=
'__all__'
template_name
=
'bookshelf/add-author.html'
\ No newline at end of file
template_name
=
'bookshelf/add-author.html'
class
editbooks_view
(
UpdateView
):
model
=
Books
fields
=
'__all__'
template_name
=
'bookshelf/edit-book.html'
class
editauthors_view
(
UpdateView
):
model
=
Author
fields
=
'__all__'
template_name
=
'bookshelf/edit-author.html'
\ No newline at end of file
garethcastillo_reading/db.sqlite3
View file @
5c4f5f85
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