Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gab_salas_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
Jose Gabriel L. Salas
gab_salas_reading
Commits
3843fa16
Commit
3843fa16
authored
Apr 25, 2023
by
Jose Gabriel L. Salas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added books and authors edit html pages inide author/book details
parent
824e5edd
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
26 additions
and
2 deletions
+26
-2
models.cpython-310.pyc
...alas_reading/bookshelf/__pycache__/models.cpython-310.pyc
+0
-0
views.cpython-310.pyc
...salas_reading/bookshelf/__pycache__/views.cpython-310.pyc
+0
-0
models.py
gab_salas_reading/bookshelf/models.py
+1
-0
author_details.html
...reading/bookshelf/templates/bookshelf/author_details.html
+5
-0
book_details.html
...s_reading/bookshelf/templates/bookshelf/book_details.html
+6
-0
edit-books.html
...las_reading/bookshelf/templates/bookshelf/edit-books.html
+11
-0
views.py
gab_salas_reading/bookshelf/views.py
+3
-2
db.sqlite3
gab_salas_reading/db.sqlite3
+0
-0
No files found.
gab_salas_reading/bookshelf/__pycache__/models.cpython-310.pyc
View file @
3843fa16
No preview for this file type
gab_salas_reading/bookshelf/__pycache__/views.cpython-310.pyc
View file @
3843fa16
No preview for this file type
gab_salas_reading/bookshelf/models.py
View file @
3843fa16
...
...
@@ -13,6 +13,7 @@ class Author(models.Model):
return
'{} {}'
.
format
(
self
.
first_name
,
self
.
last_name
)
def
get_absolute_url
(
self
):
prime
=
self
.
pk
return
reverse
(
'bookshelf:authors-detail'
,
kwargs
=
{
'pk'
:
self
.
pk
})
class
Books
(
models
.
Model
):
...
...
gab_salas_reading/bookshelf/templates/bookshelf/author_details.html
View file @
3843fa16
...
...
@@ -11,6 +11,11 @@
{{object.bio}}
<br>
<br>
<a
href=
"/bookshelf/authors/{{ object.pk }}/edit"
>
<button>
Edit Author
</button>
</a>
<br>
<br>
<h>
Books by {{ object }} I love:
</h>
<br>
{% for book in books %}
...
...
gab_salas_reading/bookshelf/templates/bookshelf/book_details.html
View file @
3843fa16
...
...
@@ -14,6 +14,12 @@
<br>
{{object.blurb}}
<br>
<br>
<a
href=
"/bookshelf/books/{{ object.pk }}/edit"
>
<button>
Edit Book
</button>
</a>
<br>
<br>
<a
href=
"/bookshelf/home/"
>
Home
</a>
<a
href=
"/bookshelf/books/"
>
Books
</a>
<a
href=
"/bookshelf/authors/"
>
Authors
</a>
...
...
gab_salas_reading/bookshelf/templates/bookshelf/edit-books.html
0 → 100644
View file @
3843fa16
{% extends 'base.html' %}
{% load static %}
{% block title %}Edit Books{% endblock %}
{% block content %}
<form
action =
""
method =
"post"
>
{% csrf_token %}
{{ form.as_p }}
<p><input
type=
"submit"
value =
"Save Changes"
></p>
</form>
{% endblock %}
gab_salas_reading/bookshelf/views.py
View file @
3843fa16
...
...
@@ -6,6 +6,7 @@ from django.views.generic.detail import DetailView
from
django.views.generic.list
import
ListView
from
.forms
import
AddBookForm
,
BookForm
from
django.views.generic.edit
import
CreateView
,
UpdateView
from
django.urls
import
reverse
def
index
(
request
):
return
render
(
request
,
'bookshelf/home.html'
,
{
'name'
:
'Gab'
})
...
...
@@ -19,17 +20,17 @@ class AuthorUpdateView(UpdateView):
model
=
Author
fields
=
'__all__'
template_name
=
'bookshelf/edit-author.html'
prime
=
Author
.
pk
class
BookCreateView
(
CreateView
):
model
=
Books
fields
=
'__all__'
template_name
=
'bookshelf/add-book.html'
class
BookUpdateView
(
UpdateView
):
model
=
Books
fields
=
'__all__'
template_name
=
'bookshelf/edit-book.html'
template_name
=
'bookshelf/edit-book
s
.html'
class
BooksListView
(
ListView
):
model
=
Books
...
...
gab_salas_reading/db.sqlite3
View file @
3843fa16
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