Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
andrada_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
Alvin Joshua Andrada
andrada_reading
Commits
56720e64
Commit
56720e64
authored
Apr 25, 2023
by
Alvin Joshua Andrada
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed urls
parent
95bf4d51
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
29 additions
and
10 deletions
+29
-10
urls.cpython-39.pyc
andrada_reading/bookshelf/__pycache__/urls.cpython-39.pyc
+0
-0
views.cpython-39.pyc
andrada_reading/bookshelf/__pycache__/views.cpython-39.pyc
+0
-0
forms.py
andrada_reading/bookshelf/forms.py
+6
-0
add-author.html
...ada_reading/bookshelf/templates/bookshelf/add-author.html
+1
-1
add-book.html
andrada_reading/bookshelf/templates/bookshelf/add-book.html
+1
-1
author_details.html
...reading/bookshelf/templates/bookshelf/author_details.html
+3
-0
book_details.html
...a_reading/bookshelf/templates/bookshelf/book_details.html
+1
-0
edit-author.html
...da_reading/bookshelf/templates/bookshelf/edit-author.html
+1
-1
edit-book.html
andrada_reading/bookshelf/templates/bookshelf/edit-book.html
+1
-1
urls.py
andrada_reading/bookshelf/urls.py
+5
-5
views.py
andrada_reading/bookshelf/views.py
+10
-1
db.sqlite3
andrada_reading/db.sqlite3
+0
-0
No files found.
andrada_reading/bookshelf/__pycache__/urls.cpython-39.pyc
View file @
56720e64
No preview for this file type
andrada_reading/bookshelf/__pycache__/views.cpython-39.pyc
View file @
56720e64
No preview for this file type
andrada_reading/bookshelf/forms.py
View file @
56720e64
...
@@ -7,3 +7,9 @@ class BookForm(forms.ModelForm):
...
@@ -7,3 +7,9 @@ class BookForm(forms.ModelForm):
class
Meta
:
class
Meta
:
model
=
Book
model
=
Book
fields
=
[
'title'
,
'author'
,
'publisher'
,
'year_published'
,
'ISBN'
,
'blurb'
]
fields
=
[
'title'
,
'author'
,
'publisher'
,
'year_published'
,
'ISBN'
,
'blurb'
]
class
AuthorForm
(
forms
.
ModelForm
):
class
Meta
:
model
=
Author
fields
=
[
'first_name'
,
'last_name'
,
'age'
,
'nationality'
,
'bio'
]
andrada_reading/bookshelf/templates/bookshelf/add-author.html
View file @
56720e64
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
</ul>
</ul>
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
<form
action=
"/authors"
method=
"post"
>
<form
method=
"post"
>
{% csrf_token %}
{% csrf_token %}
{{ form }}
{{ form }}
<input
type=
"submit"
value=
"Add Author"
>
<input
type=
"submit"
value=
"Add Author"
>
...
...
andrada_reading/bookshelf/templates/bookshelf/add-book.html
View file @
56720e64
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
</ul>
</ul>
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
<form
action=
"/books"
method=
"post"
>
<form
method=
"post"
>
{% csrf_token %}
{% csrf_token %}
{{ form }}
{{ form }}
<input
type=
"submit"
value=
"Add Book"
>
<input
type=
"submit"
value=
"Add Book"
>
...
...
andrada_reading/bookshelf/templates/bookshelf/author_details.html
View file @
56720e64
...
@@ -8,6 +8,9 @@
...
@@ -8,6 +8,9 @@
<h4>
{{ author.age }}
</h4>
<h4>
{{ author.age }}
</h4>
<h4>
{{ author.nationality }}
</h4>
<h4>
{{ author.nationality }}
</h4>
<h4>
{{ author.bio }}
</h4>
<h4>
{{ author.bio }}
</h4>
<button
href=
"{% url 'bookshelf:edit-author' object.id %}"
>
Edit Author
</button>
<br>
<h4>
Books by {{ author.first_name }} {{ author.last_name }} I love:
</h4>
<h4>
Books by {{ author.first_name }} {{ author.last_name }} I love:
</h4>
<ul>
<ul>
{% for book in books_list %}
{% for book in books_list %}
...
...
andrada_reading/bookshelf/templates/bookshelf/book_details.html
View file @
56720e64
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
<h3>
{{ object.year_published }}
</h3>
<h3>
{{ object.year_published }}
</h3>
<h3>
{{ object.ISBN }}
</h3>
<h3>
{{ object.ISBN }}
</h3>
<h3>
{{ object.blurb }}
</h3>
<h3>
{{ object.blurb }}
</h3>
<button
href=
"{% url 'bookshelf:edit-book' object.id %}"
>
Edit Book
</button>
<br>
<a
href=
"/home/"
>
Home
</a>
<a
href=
"/home/"
>
Home
</a>
<a
href=
"/home/books/"
>
Books
</a>
<a
href=
"/home/books/"
>
Books
</a>
<a
href=
"/home/authors/"
>
Authors
</a>
<a
href=
"/home/authors/"
>
Authors
</a>
...
...
andrada_reading/bookshelf/templates/bookshelf/edit-author.html
View file @
56720e64
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
</ul>
</ul>
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
<form
action=
"home/authors"
method=
"post"
>
<form
method=
"post"
>
{% csrf_token %}
{% csrf_token %}
{{ form }}
{{ form }}
<input
type=
"submit"
value=
"Save Changes"
>
<input
type=
"submit"
value=
"Save Changes"
>
...
...
andrada_reading/bookshelf/templates/bookshelf/edit-book.html
View file @
56720e64
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
</ul>
</ul>
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
<form
action=
"home/books"
method=
"post"
>
<form
method=
"post"
>
{% csrf_token %}
{% csrf_token %}
{{ form }}
{{ form }}
<input
type=
"submit"
value=
"Save Changes"
>
<input
type=
"submit"
value=
"Save Changes"
>
...
...
andrada_reading/bookshelf/urls.py
View file @
56720e64
...
@@ -6,14 +6,14 @@ from .views import (BooksView, AuthorsView, BookDetailView, AuthorDetailView,
...
@@ -6,14 +6,14 @@ from .views import (BooksView, AuthorsView, BookDetailView, AuthorDetailView,
urlpatterns
=
[
urlpatterns
=
[
path
(
''
,
views
.
home_view
,
name
=
'home'
),
path
(
''
,
views
.
home_view
,
name
=
'home'
),
path
(
'books/add/'
,
BookCreateView
.
as_view
(),
name
=
'add-book'
),
path
(
'authors/add/'
,
AuthorCreateView
.
as_view
(),
name
=
'add-author'
),
path
(
'books/<int:pk>/edit/'
,
BookUpdateView
.
as_view
(),
name
=
'edit-book'
),
path
(
'authors/<int:pk>/edit/'
,
AuthorUpdateView
.
as_view
(),
name
=
'edit-author'
),
path
(
'books/'
,
BooksView
.
as_view
(),
name
=
'book-list'
),
path
(
'books/'
,
BooksView
.
as_view
(),
name
=
'book-list'
),
path
(
'authors/'
,
AuthorsView
.
as_view
(),
name
=
'author-list'
),
path
(
'authors/'
,
AuthorsView
.
as_view
(),
name
=
'author-list'
),
path
(
'books/<int:pk>/details'
,
BookDetailView
.
as_view
(),
name
=
'book-detail'
),
path
(
'books/<int:pk>/details
/
'
,
BookDetailView
.
as_view
(),
name
=
'book-detail'
),
path
(
'authors/<int:author_id>/details/'
,
AuthorDetailView
.
as_view
(),
name
=
'author-detail'
),
path
(
'authors/<int:author_id>/details/'
,
AuthorDetailView
.
as_view
(),
name
=
'author-detail'
),
path
(
'books/add/'
,
BookCreateView
.
as_view
(),
name
=
'add-book'
),
path
(
'authors/add/'
,
AuthorCreateView
.
as_view
(),
name
=
'add-author'
),
path
(
'books/<int:pk>/edit'
,
BookUpdateView
.
as_view
(),
name
=
'edit-book'
),
path
(
'authors/<int:pk>/edit'
,
AuthorUpdateView
.
as_view
(),
name
=
'edit-author'
),
]
]
app_name
=
"bookshelf"
app_name
=
"bookshelf"
andrada_reading/bookshelf/views.py
View file @
56720e64
...
@@ -4,6 +4,7 @@ from django.http import HttpResponse
...
@@ -4,6 +4,7 @@ from django.http import HttpResponse
from
django.views
import
View
from
django.views
import
View
from
django.views.generic.detail
import
DetailView
from
django.views.generic.detail
import
DetailView
from
django.views.generic.list
import
ListView
from
django.views.generic.list
import
ListView
from
django.urls
import
reverse
from
django.views.generic.edit
import
CreateView
,
UpdateView
from
django.views.generic.edit
import
CreateView
,
UpdateView
...
@@ -34,18 +35,26 @@ class BookCreateView(CreateView):
...
@@ -34,18 +35,26 @@ class BookCreateView(CreateView):
model
=
Books
model
=
Books
fields
=
'__all__'
fields
=
'__all__'
template_name
=
'bookshelf/add-book.html'
template_name
=
'bookshelf/add-book.html'
def
get_success_url
(
self
):
return
reverse
(
'bookshelf:book-detail'
,
kwargs
=
{
'pk'
:
self
.
object
.
pk
})
class
BookUpdateView
(
UpdateView
):
class
BookUpdateView
(
UpdateView
):
model
=
Books
model
=
Books
fields
=
'__all__'
fields
=
'__all__'
template_name
=
'bookshelf/edit-book.html'
template_name
=
'bookshelf/edit-book.html'
def
get_success_url
(
self
):
return
reverse
(
'bookshelf:book-detail'
,
kwargs
=
{
'pk'
:
self
.
object
.
pk
})
class
AuthorCreateView
(
CreateView
):
class
AuthorCreateView
(
CreateView
):
model
=
Author
model
=
Author
fields
=
'__all__'
fields
=
'__all__'
template_name
=
'bookshelf/add-author.html'
template_name
=
'bookshelf/add-author.html'
def
get_success_url
(
self
):
return
reverse
(
'bookshelf:author-detail'
,
kwargs
=
{
'author_id'
:
self
.
object
.
pk
})
class
AuthorUpdateView
(
UpdateView
):
class
AuthorUpdateView
(
UpdateView
):
model
=
Books
model
=
Books
fields
=
'__all__'
fields
=
'__all__'
template_name
=
'bookshelf/edit-author.html'
template_name
=
'bookshelf/edit-author.html'
\ No newline at end of file
def
get_success_url
(
self
):
return
reverse
(
'bookshelf:author-detail'
,
kwargs
=
{
'author_id'
:
self
.
object
.
pk
})
\ No newline at end of file
andrada_reading/db.sqlite3
View file @
56720e64
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