Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
lexchan_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
Lex Philip Gabriel D. Chan
lexchan_reading
Commits
a454e76c
Commit
a454e76c
authored
Apr 25, 2023
by
Lex Philip Gabriel D. Chan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Created Forms for User Input
parent
af75f49c
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
102 additions
and
4 deletions
+102
-4
urls.cpython-39.pyc
lexchan_reading/bookshelf/__pycache__/urls.cpython-39.pyc
+0
-0
views.cpython-39.pyc
lexchan_reading/bookshelf/__pycache__/views.cpython-39.pyc
+0
-0
forms.py
lexchan_reading/bookshelf/forms.py
+12
-0
add-author.html
...han_reading/bookshelf/templates/bookshelf/add-author.html
+13
-0
add-book.html
lexchan_reading/bookshelf/templates/bookshelf/add-book.html
+13
-0
author_details.html
...reading/bookshelf/templates/bookshelf/author_details.html
+1
-0
book_details.html
...n_reading/bookshelf/templates/bookshelf/book_details.html
+2
-1
edit-author.html
...an_reading/bookshelf/templates/bookshelf/edit-author.html
+13
-0
edit-book.html
lexchan_reading/bookshelf/templates/bookshelf/edit-book.html
+13
-0
home.html
lexchan_reading/bookshelf/templates/bookshelf/home.html
+3
-0
urls.py
lexchan_reading/bookshelf/urls.py
+9
-1
views.py
lexchan_reading/bookshelf/views.py
+23
-2
db.sqlite3
lexchan_reading/db.sqlite3
+0
-0
No files found.
lexchan_reading/bookshelf/__pycache__/urls.cpython-39.pyc
View file @
a454e76c
No preview for this file type
lexchan_reading/bookshelf/__pycache__/views.cpython-39.pyc
View file @
a454e76c
No preview for this file type
lexchan_reading/bookshelf/forms.py
0 → 100644
View file @
a454e76c
from
django
import
forms
from
.models
import
Author
,
Books
class
BookForm
(
forms
.
ModelForm
):
class
Meta
:
model
=
Books
fields
=
'__all__'
class
SubjectForm
(
forms
.
ModelForm
):
class
Meta
:
model
=
Author
fields
=
'__all__'
\ No newline at end of file
lexchan_reading/bookshelf/templates/bookshelf/add-author.html
0 → 100644
View file @
a454e76c
{% extends 'base.html' %}
{% block title %}Add New Author{% endblock %}
{% block content %}
<br>
<form
method=
"post"
>
{% csrf_token %}
{% for field in form %}
{{field.label}}:{{field}}
<br><br>
{% endfor %}
<input
type=
"submit"
value=
"Add Author"
>
</form>
{% endblock %}
\ No newline at end of file
lexchan_reading/bookshelf/templates/bookshelf/add-book.html
0 → 100644
View file @
a454e76c
{% extends 'base.html' %}
{% block title %}Add New Book{% endblock %}
{% block content %}
<br>
<form
method=
"post"
>
{% csrf_token %}
{% for field in form %}
{{field.label}}:{{field}}
<br><br>
{% endfor %}
<input
type=
"submit"
value=
"Add Book"
>
</form>
{% endblock %}
\ No newline at end of file
lexchan_reading/bookshelf/templates/bookshelf/author_details.html
View file @
a454e76c
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
</li>
</li>
{% endfor %}
{% endfor %}
</ul>
</ul>
<button
class=
"button"
><a
href=
"/bookshelf/authors/{{ object.pk }}/edit"
>
Edit Author
</a></button>
<center>
<center>
<button
class=
"button"
><a
href=
"/bookshelf/home"
>
Home
</a></button>
<button
class=
"button"
><a
href=
"/bookshelf/home"
>
Home
</a></button>
<button
class=
"button"
><a
href=
"/bookshelf/books"
>
Books
</a></button>
<button
class=
"button"
><a
href=
"/bookshelf/books"
>
Books
</a></button>
...
...
lexchan_reading/bookshelf/templates/bookshelf/book_details.html
View file @
a454e76c
...
@@ -3,13 +3,14 @@
...
@@ -3,13 +3,14 @@
{% block title %}{{ object.title }}{% endblock %}
{% block title %}{{ object.title }}{% endblock %}
{% block content %}
{% block content %}
<h1>
{{ object.title }}
</h1>
<h1>
{{ object.title }}
</h1>
<h3><a
href=
"{{ object.author.get_absolute_url}}"
>
<h3><a
href=
"{{ object.author.get_absolute_url
}}"
>
{{ object.author }}
{{ object.author }}
</a></h3>
</a></h3>
<h3>
{{ object.publisher }}
</h3>
<h3>
{{ object.publisher }}
</h3>
<h3>
{{ object.year_published }}
</h3>
<h3>
{{ object.year_published }}
</h3>
<h3>
{{ object.ISBN }}
</h3>
<h3>
{{ object.ISBN }}
</h3>
<p>
{{ object.blurb }}
</p>
<p>
{{ object.blurb }}
</p>
<button
class=
"button"
><a
href=
"/bookshelf/books/{{ object.pk }}/edit"
>
Edit Book
</a></button>
<center>
<center>
<button
class=
"button"
><a
href=
"/bookshelf/home"
>
Home
</a></button>
<button
class=
"button"
><a
href=
"/bookshelf/home"
>
Home
</a></button>
<button
class=
"button"
><a
href=
"/bookshelf/books"
>
Books
</a></button>
<button
class=
"button"
><a
href=
"/bookshelf/books"
>
Books
</a></button>
...
...
lexchan_reading/bookshelf/templates/bookshelf/edit-author.html
0 → 100644
View file @
a454e76c
{% extends 'base.html' %}
{% block title %}Edit Author{% endblock %}
{% block content %}
<br>
<form
method=
"post"
>
{% csrf_token %}
{% for field in form %}
{{field.label}}:{{field}}
<br><br>
{% endfor %}
<input
type=
"submit"
value=
"Save Changes"
>
</form>
{% endblock %}
\ No newline at end of file
lexchan_reading/bookshelf/templates/bookshelf/edit-book.html
0 → 100644
View file @
a454e76c
{% extends 'base.html' %}
{% block title %}Edit Book{% endblock %}
{% block content %}
<br>
<form
method=
"post"
>
{% csrf_token %}
{% for field in form %}
{{field.label}}:{{field}}
<br><br>
{% endfor %}
<input
type=
"submit"
value=
"Save Changes"
>
</form>
{% endblock %}
\ No newline at end of file
lexchan_reading/bookshelf/templates/bookshelf/home.html
View file @
a454e76c
...
@@ -11,5 +11,8 @@
...
@@ -11,5 +11,8 @@
<br>
<br>
<button
class=
"button"
><a
href=
"/bookshelf/books"
>
Books
</a></button>
<button
class=
"button"
><a
href=
"/bookshelf/books"
>
Books
</a></button>
<button
class=
"button"
><a
href=
"/bookshelf/authors"
>
Authors
</a></button>
<button
class=
"button"
><a
href=
"/bookshelf/authors"
>
Authors
</a></button>
<br>
<button
class=
"button"
><a
href=
"/bookshelf/books/add/"
>
Add Book
</a></button>
<button
class=
"button"
><a
href=
"/bookshelf/authors/add/"
>
Add Author
</a></button>
</center>
</center>
{% endblock %}
{% endblock %}
\ No newline at end of file
lexchan_reading/bookshelf/urls.py
View file @
a454e76c
...
@@ -5,7 +5,11 @@ from .views import (
...
@@ -5,7 +5,11 @@ from .views import (
BooksListView
,
BooksListView
,
BooksDetailView
,
BooksDetailView
,
AuthorsListView
,
AuthorsListView
,
AuthorsDetailView
AuthorsDetailView
,
BookCreateView
,
BookUpdateView
,
AuthorCreateView
,
AuthorUpdateView
)
)
urlpatterns
=
[
urlpatterns
=
[
path
(
'home/'
,
index
,
name
=
'homepage'
),
path
(
'home/'
,
index
,
name
=
'homepage'
),
...
@@ -13,6 +17,10 @@ urlpatterns = [
...
@@ -13,6 +17,10 @@ urlpatterns = [
path
(
'books/<int:pk>/details/'
,
BooksDetailView
.
as_view
(),
name
=
'book_details'
),
path
(
'books/<int:pk>/details/'
,
BooksDetailView
.
as_view
(),
name
=
'book_details'
),
path
(
'authors/'
,
AuthorsListView
.
as_view
(),
name
=
'authors'
),
path
(
'authors/'
,
AuthorsListView
.
as_view
(),
name
=
'authors'
),
path
(
'authors/<int:pk>/details/'
,
AuthorsDetailView
.
as_view
(),
name
=
'author_details'
),
path
(
'authors/<int:pk>/details/'
,
AuthorsDetailView
.
as_view
(),
name
=
'author_details'
),
path
(
'books/add/'
,
BookCreateView
.
as_view
(),
name
=
'book_add'
),
path
(
'books/<int:pk>/edit/'
,
BookUpdateView
.
as_view
(),
name
=
'book_update'
),
path
(
'authors/add/'
,
AuthorCreateView
.
as_view
(),
name
=
'author_add'
),
path
(
'authors/<int:pk>/edit/'
,
AuthorUpdateView
.
as_view
(),
name
=
'author_update'
),
]
]
app_name
=
"bookshelf"
app_name
=
"bookshelf"
\ No newline at end of file
lexchan_reading/bookshelf/views.py
View file @
a454e76c
...
@@ -3,6 +3,7 @@ from django.http import HttpResponse
...
@@ -3,6 +3,7 @@ from django.http import HttpResponse
from
django.views
import
View
from
django.views
import
View
from
django.views.generic.list
import
ListView
from
django.views.generic.list
import
ListView
from
django.views.generic.detail
import
DetailView
from
django.views.generic.detail
import
DetailView
from
django.views.generic.edit
import
CreateView
,
UpdateView
from
.models
import
Author
,
Books
from
.models
import
Author
,
Books
...
@@ -24,3 +25,23 @@ class AuthorsListView(ListView):
...
@@ -24,3 +25,23 @@ class AuthorsListView(ListView):
class
AuthorsDetailView
(
DetailView
):
class
AuthorsDetailView
(
DetailView
):
model
=
Author
model
=
Author
template_name
=
'bookshelf/author_details.html'
template_name
=
'bookshelf/author_details.html'
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'
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'
\ No newline at end of file
lexchan_reading/db.sqlite3
View file @
a454e76c
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