Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
rachpurisima_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
Rachel
rachpurisima_reading
Commits
5ba2dfc3
Commit
5ba2dfc3
authored
Apr 25, 2023
by
rachbit
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added edit-author and add-author
parent
ba420ee3
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
133 additions
and
11 deletions
+133
-11
forms.py
rachpurisima_reading/bookshelf/forms.py
+7
-1
add-author.html
...ima_reading/bookshelf/templates/bookshelf/add-author.html
+31
-0
add-book.html
...isima_reading/bookshelf/templates/bookshelf/add-book.html
+7
-0
author_details.html
...reading/bookshelf/templates/bookshelf/author_details.html
+9
-0
authors.html
...risima_reading/bookshelf/templates/bookshelf/authors.html
+2
-0
book_details.html
...a_reading/bookshelf/templates/bookshelf/book_details.html
+3
-1
books.html
...purisima_reading/bookshelf/templates/bookshelf/books.html
+2
-0
edit-author.html
...ma_reading/bookshelf/templates/bookshelf/edit-author.html
+32
-0
edit-book.html
...sima_reading/bookshelf/templates/bookshelf/edit-book.html
+14
-6
home.html
rachpurisima_reading/bookshelf/templates/bookshelf/home.html
+1
-1
views.py
rachpurisima_reading/bookshelf/templates/bookshelf/views.py
+8
-0
urls.py
rachpurisima_reading/bookshelf/urls.py
+4
-2
views.py
rachpurisima_reading/bookshelf/views.py
+12
-0
base.html
rachpurisima_reading/templates/base.html
+1
-0
No files found.
rachpurisima_reading/bookshelf/forms.py
View file @
5ba2dfc3
from
django
import
forms
from
.models
import
Books
from
.models
import
Books
,
Authors
class
BookForm
(
forms
.
Form
):
class
Meta
:
model
=
Books
fields
=
'__all__'
class
AuthorForm
(
forms
.
Form
):
class
Meta
:
model
=
Authors
fields
=
'__all__'
rachpurisima_reading/bookshelf/templates/bookshelf/add-author.html
0 → 100644
View file @
5ba2dfc3
{% extends 'base.html' %}
{% load static %}
{% block title %}Add an Author{% endblock %}
{% block header %}
<cite><h1
class=
"text-center"
>
Hindi pa ba ako sapat?
</h1></cite>
{% endblock %}
{% block subtitle %}
<p
class=
"text-center"
>
feel free to add more authors to my collection.
<br>
-
</p>
{% endblock %}
<div
class=
"text-center"
>
</div>
{% block form %}
<form
method=
"post"
>
{% csrf_token %}
{{ form.as_p }}
<input
type=
"submit"
value=
"Add Author"
>
</form>
</div>
{% endblock %}
{% block navbar %}
<li><a
href=
"/bookshelf/home"
>
Home
</a></li>
<li><a
href=
"/bookshelf/books"
>
Books
</a></li>
<li><a
href=
"/bookshelf/authors"
>
Authors
</a></li>
<li><a
href=
"/bookshelf/books/add"
>
Add Book
</a></li>
<li><a
href=
"/bookshelf/authors/add"
>
Add Author
</a></li>
{% endblock %}
rachpurisima_reading/bookshelf/templates/bookshelf/add-book.html
View file @
5ba2dfc3
...
...
@@ -22,3 +22,10 @@
</form>
</div>
{% endblock %}
{% block navbar %}
<li><a
href=
"/bookshelf/home"
>
Home
</a></li>
<li><a
href=
"/bookshelf/books"
>
Books
</a></li>
<li><a
href=
"/bookshelf/authors"
>
Authors
</a></li>
<li><a
href=
"/bookshelf/books/add"
>
Add Book
</a></li>
<li><a
href=
"/bookshelf/authors/add"
>
Add Author
</a></li>
{% endblock %}
rachpurisima_reading/bookshelf/templates/bookshelf/author_details.html
View file @
5ba2dfc3
...
...
@@ -28,6 +28,13 @@ read between their lines<br>
</div>
</ul>
<br>
<div
class=
"text-center"
>
<form
action=
"edit"
>
<input
type=
"submit"
value=
"Edit Author"
>
</form>
</div>
<br>
<br>
<h2>
Books by {{object.first_name}} {{object.last_name}} that I love:
</h2>
<ul>
{% for book in object.books.all %}
...
...
@@ -41,4 +48,6 @@ read between their lines<br>
<li><a
href=
"/bookshelf/home"
>
Home
</a></li>
<li><a
href=
"/bookshelf/books"
>
Books
</a></li>
<li><a
href=
"/bookshelf/authors"
>
Authors
</a></li>
<li><a
href=
"/bookshelf/books/add"
>
Add Book
</a></li>
<li><a
href=
"/bookshelf/authors/add"
>
Add Author
</a></li>
{% endblock %}
rachpurisima_reading/bookshelf/templates/bookshelf/authors.html
View file @
5ba2dfc3
...
...
@@ -30,4 +30,6 @@
<li><a
href=
"/bookshelf/home"
>
Home
</a></li>
<li><a
href=
"/bookshelf/books"
>
Books
</a></li>
<li><a
href=
"#"
>
Authors
</a></li>
<li><a
href=
"/bookshelf/books/add"
>
Add Book
</a></li>
<li><a
href=
"/bookshelf/authors/add"
>
Add Author
</a></li>
{% endblock %}
rachpurisima_reading/bookshelf/templates/bookshelf/book_details.html
View file @
5ba2dfc3
...
...
@@ -27,7 +27,7 @@ fundamental.<br>
</ul>
<br>
<div
class=
"text-center"
>
<form
action=
"edit"
>
<form
action=
"edit
/{{ object.book.get_absolute_url }}
"
>
<input
type=
"submit"
value=
"Edit Book"
>
</form>
</div>
...
...
@@ -37,4 +37,6 @@ fundamental.<br>
<li><a
href=
"/bookshelf/home"
>
Home
</a></li>
<li><a
href=
"/bookshelf/books"
>
Books
</a></li>
<li><a
href=
"/bookshelf/authors"
>
Authors
</a></li>
<li><a
href=
"/bookshelf/books/add"
>
Add Book
</a></li>
<li><a
href=
"/bookshelf/authors/add"
>
Add Author
</a></li>
{% endblock %}
rachpurisima_reading/bookshelf/templates/bookshelf/books.html
View file @
5ba2dfc3
...
...
@@ -28,4 +28,6 @@
<li><a
href=
"/bookshelf/home"
>
Home
</a></li>
<li><a
href=
"#"
>
Books
</a></li>
<li><a
href=
"/bookshelf/authors"
>
Authors
</a></li>
<li><a
href=
"/bookshelf/books/add"
>
Add Book
</a></li>
<li><a
href=
"/bookshelf/authors/add"
>
Add Author
</a></li>
{% endblock %}
rachpurisima_reading/bookshelf/templates/bookshelf/edit-author.html
0 → 100644
View file @
5ba2dfc3
{% extends 'base.html' %}
{% load static %}
{% block title %}Edit Author{% endblock %}
{% block header %}
<cite><h1
class=
"text-center"
>
May pagkakamali ba ako?
</h1></cite>
{% endblock %}
{% block subtitle %}
<p
class=
"text-center"
>
feel free to edit author details in my collection.
<br>
-
</p>
{% endblock %}
<div
class=
"text-center"
>
</div>
{% block form %}
<form
method=
"post"
>
{% csrf_token %}
{% for field in form %}
{{field.label}}:{{field}}
<br><br>
{% endfor %}
<input
type=
"submit"
value=
"Save Changes"
>
</form>
{% endblock %}
{% block navbar %}
<li><a
href=
"/bookshelf/home"
>
Home
</a></li>
<li><a
href=
"/bookshelf/books"
>
Books
</a></li>
<li><a
href=
"/bookshelf/authors"
>
Authors
</a></li>
<li><a
href=
"/bookshelf/books/add"
>
Add Book
</a></li>
<li><a
href=
"/bookshelf/authors/add"
>
Add Author
</a></li>
{% endblock %}
rachpurisima_reading/bookshelf/templates/bookshelf/edit-book.html
View file @
5ba2dfc3
...
...
@@ -15,10 +15,18 @@
</div>
{% block form %}
<form
method=
"post"
>
<form
method=
"post"
>
{% csrf_token %}
{{ form.as_p }}
{% for field in form %}
{{field.label}}:{{field}}
<br><br>
{% endfor %}
<input
type=
"submit"
value=
"Save Changes"
>
</form>
</div>
</form>
{% endblock %}
{% block navbar %}
<li><a
href=
"/bookshelf/home"
>
Home
</a></li>
<li><a
href=
"/bookshelf/books"
>
Books
</a></li>
<li><a
href=
"/bookshelf/authors"
>
Authors
</a></li>
<li><a
href=
"/bookshelf/books/add"
>
Add Book
</a></li>
<li><a
href=
"/bookshelf/authors/add"
>
Add Author
</a></li>
{% endblock %}
rachpurisima_reading/bookshelf/templates/bookshelf/home.html
View file @
5ba2dfc3
...
...
@@ -22,5 +22,5 @@
<li><a
href=
"/bookshelf/books"
>
Books
</a></li>
<li><a
href=
"/bookshelf/authors"
>
Authors
</a></li>
<li><a
href=
"/bookshelf/books/add"
>
Add Book
</a></li>
<li><a
href=
"
#
"
>
Add Author
</a></li>
<li><a
href=
"
/bookshelf/authors/add
"
>
Add Author
</a></li>
{% endblock %}
rachpurisima_reading/bookshelf/templates/bookshelf/views.py
0 → 100644
View file @
5ba2dfc3
from
django.shortcuts
import
render
from
django.http
import
HttpResponse
# Create your views here.
def
index
(
request
):
return
HttpResponse
(
'Welcome to Rachel’s Music Library!'
)
rachpurisima_reading/bookshelf/urls.py
View file @
5ba2dfc3
from
django.urls
import
path
from
.views
import
index
,
home
,
BooksView
,
AuthorsView
,
BookDetailView
,
AuthorDetailView
,
BookCreateView
,
BookUpdateView
from
.views
import
index
,
home
,
BooksView
,
AuthorsView
,
BookDetailView
,
AuthorDetailView
,
BookCreateView
,
BookUpdateView
,
AuthorCreateView
,
AuthorUpdateView
urlpatterns
=
[
path
(
''
,
index
,
name
=
'index'
),
...
...
@@ -10,7 +10,9 @@ urlpatterns = [
path
(
'authors/<int:pk>/details/'
,
AuthorDetailView
.
as_view
(),
name
=
'author_details'
),
path
(
'books/add/'
,
BookCreateView
.
as_view
(),
name
=
'add-book'
),
path
(
'books/<int:pk>/edit/'
,
BookUpdateView
.
as_view
(),
name
=
'edit-book'
),
path
(
'books/<int:pk>/details/edit/'
,
BookUpdateView
.
as_view
(),
name
=
'edit-book'
),
path
(
'authors/add/'
,
AuthorCreateView
.
as_view
(),
name
=
'add-author'
),
path
(
'authors/<int:pk>/details/edit/'
,
AuthorUpdateView
.
as_view
(),
name
=
'edit-author'
),
]
app_name
=
"bookshelf"
rachpurisima_reading/bookshelf/views.py
View file @
5ba2dfc3
...
...
@@ -35,6 +35,18 @@ class BookUpdateView(UpdateView):
template_name
=
"bookshelf/edit-book.html"
class
AuthorCreateView
(
CreateView
):
model
=
Author
fields
=
'__all__'
template_name
=
"bookshelf/add-author.html"
class
AuthorUpdateView
(
UpdateView
):
model
=
Author
fields
=
'__all__'
template_name
=
"bookshelf/edit-author.html"
class
AuthorsView
(
ListView
):
model
=
Author
template_name
=
'bookshelf/authors.html'
...
...
rachpurisima_reading/templates/base.html
View file @
5ba2dfc3
...
...
@@ -51,6 +51,7 @@
</figure>
</figure>
</body>
<br><br><br>
<nav
class=
"navbar navbar-custom"
>
<div
class=
"container-center"
>
<ul
class=
"nav navbar-nav navbar-center"
>
...
...
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