Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
sharmchua_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
Sharmaine Chua
sharmchua_reading
Commits
139b0a03
Commit
139b0a03
authored
Apr 25, 2023
by
Sharmaine Chua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added form pages and edited the template file
parent
46b8410e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
1 deletion
+45
-1
add-author.html
...hua_reading/bookshelf/templates/bookshelf/add-author.html
+14
-0
add-book.html
...mchua_reading/bookshelf/templates/bookshelf/add-book.html
+14
-0
home.html
sharmchua_reading/bookshelf/templates/bookshelf/home.html
+3
-0
urls.py
sharmchua_reading/bookshelf/urls.py
+2
-0
views.py
sharmchua_reading/bookshelf/views.py
+12
-1
No files found.
sharmchua_reading/bookshelf/templates/bookshelf/add-author.html
0 → 100644
View file @
139b0a03
{% extends 'base.html' %}
{% load static %}
{% block title %}Add New Author{% endblock %}
{% block content %}
<div
class=
"add-author"
>
<form
method=
"post"
>
{% csrf_token %}
{{ form.as_p }}
<button
type=
"submit"
>
Submit
</button>
</form>
</div>
{% endblock %}
\ No newline at end of file
sharmchua_reading/bookshelf/templates/bookshelf/add-book.html
0 → 100644
View file @
139b0a03
{% extends 'base.html' %}
{% load static %}
{% block title %}Add New Book{% endblock %}
{% block content %}
<div
class=
"add_book"
>
<form
method=
"post"
>
{% csrf_token %}
{{ form.as_p }}
<button
type=
"submit"
>
Submit
</button>
</form>
</div>
{% endblock %}
\ No newline at end of file
sharmchua_reading/bookshelf/templates/bookshelf/home.html
View file @
139b0a03
...
@@ -18,6 +18,9 @@
...
@@ -18,6 +18,9 @@
<a
href=
"../authors"
>
<a
href=
"../authors"
>
<button
type=
"button"
><p>
Authors
</p></button>
<button
type=
"button"
><p>
Authors
</p></button>
</a>
</a>
<br>
<a
href=
"../books/add"
>
Add Book
</a>
<a
href=
"../authors/add"
>
Add Author
</a>
</div>
</div>
</center>
</center>
{% endblock %}
{% endblock %}
\ No newline at end of file
sharmchua_reading/bookshelf/urls.py
View file @
139b0a03
...
@@ -7,6 +7,8 @@ urlpatterns = [
...
@@ -7,6 +7,8 @@ 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/'
,
AuthorListView
.
as_view
(),
name
=
'author_list'
),
path
(
'authors/'
,
AuthorListView
.
as_view
(),
name
=
'author_list'
),
path
(
'authors/<int:pk>/details'
,
AuthorDetailView
.
as_view
(),
name
=
'author_details'
),
path
(
'authors/<int:pk>/details'
,
AuthorDetailView
.
as_view
(),
name
=
'author_details'
),
path
(
'books/add'
,
BooksCreateView
.
as_view
(),
name
=
'create_book'
),
path
(
'authors/add'
,
AuthorCreateView
.
as_view
(),
name
=
'new_author'
),
]
]
app_name
=
'bookshelf'
app_name
=
'bookshelf'
\ No newline at end of file
sharmchua_reading/bookshelf/views.py
View file @
139b0a03
...
@@ -2,6 +2,7 @@ from django.shortcuts import render
...
@@ -2,6 +2,7 @@ from django.shortcuts import render
from
django.http
import
HttpResponse
,
request
from
django.http
import
HttpResponse
,
request
from
django.views
import
View
from
django.views
import
View
from
.models
import
Author
,
Books
from
.models
import
Author
,
Books
from
django.views.generic.edit
import
CreateView
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
...
@@ -17,10 +18,20 @@ class BooksDetailView(DetailView):
...
@@ -17,10 +18,20 @@ class BooksDetailView(DetailView):
model
=
Books
model
=
Books
template_name
=
'bookshelf/book_details.html'
template_name
=
'bookshelf/book_details.html'
class
BooksCreateView
(
CreateView
):
model
=
Books
template_name
=
'bookshelf/add-book.html'
fields
=
'__all__'
class
AuthorListView
(
ListView
):
class
AuthorListView
(
ListView
):
model
=
Author
model
=
Author
template_name
=
'bookshelf/authors.html'
template_name
=
'bookshelf/authors.html'
class
AuthorDetailView
(
DetailView
):
class
AuthorDetailView
(
DetailView
):
model
=
Author
model
=
Author
template_name
=
'bookshelf/author_details.html'
template_name
=
'bookshelf/author_details.html'
\ No newline at end of file
class
AuthorCreateView
(
CreateView
):
model
=
Author
template_name
=
'bookshelf/add-author.html'
fields
=
'__all__'
\ No newline at end of file
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