Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
Neptune_Sy_music
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
Star Neptune R. Sy
Neptune_Sy_music
Commits
e3dc6a99
Commit
e3dc6a99
authored
Apr 25, 2023
by
Star Neptune R. Sy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
front end of add-book.html is done
parent
d8309378
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
81 additions
and
3 deletions
+81
-3
forms.py
neptunesy_reading/bookshelf/forms.py
+2
-0
models.py
neptunesy_reading/bookshelf/models.py
+4
-1
add-author.html
...esy_reading/bookshelf/templates/bookshelf/add-author.html
+29
-0
add-book.html
...unesy_reading/bookshelf/templates/bookshelf/add-book.html
+29
-0
home.html
neptunesy_reading/bookshelf/templates/home.html
+4
-1
urls.py
neptunesy_reading/bookshelf/urls.py
+4
-1
views.py
neptunesy_reading/bookshelf/views.py
+9
-0
No files found.
neptunesy_reading/bookshelf/forms.py
0 → 100644
View file @
e3dc6a99
from
django
import
forms
neptunesy_reading/bookshelf/models.py
View file @
e3dc6a99
...
@@ -31,4 +31,7 @@ class Book(models.Model):
...
@@ -31,4 +31,7 @@ class Book(models.Model):
return
self
.
title
return
self
.
title
def
get_absolute_url
(
self
):
def
get_absolute_url
(
self
):
return
self
.
pk
return
self
.
pk
\ No newline at end of file
def
getYearPublished
(
self
):
return
self
.
year_published
.
year
\ No newline at end of file
neptunesy_reading/bookshelf/templates/bookshelf/add-author.html
0 → 100644
View file @
e3dc6a99
{% extends 'base.html '%}
{% block title %} Add new Author {% endblock %}
{% block content %}
<form
action=
"/"
method=
"post"
>
{% csrf_token %}
<label
for=
"title"
>
Title:
</label>
<input
type=
"text"
id=
"textField"
name=
"title"
><br><br>
<label
for=
"author"
>
Author:
</label>
<select
id=
"selectField"
name=
'author'
>
{% for author in object_list %}
<option
value=
{{
author
}}
>
{{ author }}
</option>
{% endfor %}
</select>
<label
for=
"publisher"
>
Publisher:
</label>
<input
type=
"text"
id=
"textField"
name=
"publisher"
><br><br>
<label
for=
"yearPublished"
>
Year published:
</label>
<input
type=
"date"
id=
"dateField"
name=
"yearPublished"
><br><br>
<label
for=
"ISBN"
>
ISBN:
</label>
<input
type=
"text"
id=
"textField"
name=
"ISBN"
><br><br>
<label
for=
"blurb"
>
Blurb:
</label>
<input
type=
"text"
id=
"textField"
name=
"blurb"
><br><br>
<input
type=
"submit"
id=
"submitButton"
value=
"Submit"
>
</form>
{% endblock %}
\ No newline at end of file
neptunesy_reading/bookshelf/templates/bookshelf/add-book.html
0 → 100644
View file @
e3dc6a99
{% extends 'base.html '%}
{% block title %} Add new book {% endblock %}
{% block content %}
<form
action=
"/"
method=
"post"
>
{% csrf_token %}
<label
for=
"title"
>
Title:
</label>
<input
type=
"text"
id=
"textField"
name=
"title"
><br><br>
<label
for=
"author"
>
Author:
</label>
<select
id=
"selectField"
name=
'author'
>
{% for author in object_list %}
<option
value=
{{
author
}}
>
{{ author }}
</option>
{% endfor %}
</select>
<label
for=
"publisher"
>
Publisher:
</label>
<input
type=
"text"
id=
"textField"
name=
"publisher"
><br><br>
<label
for=
"yearPublished"
>
Year published:
</label>
<input
type=
"date"
id=
"dateField"
name=
"yearPublished"
><br><br>
<label
for=
"ISBN"
>
ISBN:
</label>
<input
type=
"text"
id=
"textField"
name=
"ISBN"
><br><br>
<label
for=
"blurb"
>
Blurb:
</label>
<input
type=
"text"
id=
"textField"
name=
"blurb"
><br><br>
<input
type=
"submit"
id=
"submitButton"
value=
"Submit"
>
</form>
{% endblock %}
\ No newline at end of file
neptunesy_reading/bookshelf/templates/home.html
View file @
e3dc6a99
...
@@ -5,10 +5,13 @@
...
@@ -5,10 +5,13 @@
{% block additional %} Welcome to Neptune's database of favorite books and authors {% endblock %}
{% block additional %} Welcome to Neptune's database of favorite books and authors {% endblock %}
{% block content %}
{% block content %}
<p>
My taste in books are very random and usually done in the spur of the moment. I cannot commit to a series.
</p>
<p>
My taste in books are very random and usually done in the spur of the moment. I cannot commit to a series.
</p>
<div>
<div>
<a
class=
"navBtn"
href=
"/books"
>
Books
</a>
<a
class=
"navBtn"
href=
"/books"
>
Books
</a>
<a
class=
"navBtn"
href=
"/authors"
>
Authors
</a>
<a
class=
"navBtn"
href=
"/authors"
>
Authors
</a>
<br>
<a
class=
"navBtn"
href=
"/books/add"
>
Add Book
</a>
<!--<a class="navBtn" href="/authors">Add Author</a>-->
</div>
</div>
{% endblock %}
{% endblock %}
neptunesy_reading/bookshelf/urls.py
View file @
e3dc6a99
# bookshelf/urls.py
# bookshelf/urls.py
from
django.urls
import
path
from
django.urls
import
path
from
.views
import
(
homeView
,
BooksView
,
BooksDetail
,
AuthorView
,
AuthorDetail
)
from
.views
import
(
homeView
,
BooksView
,
Books
AddView
,
Books
Detail
,
AuthorView
,
AuthorDetail
)
from
django.conf.urls.static
import
static
from
django.conf.urls.static
import
static
urlpatterns
=
[
urlpatterns
=
[
...
@@ -9,6 +9,9 @@ urlpatterns = [
...
@@ -9,6 +9,9 @@ urlpatterns = [
path
(
'books/<int:pk>/details/'
,
BooksDetail
.
as_view
(),
name
=
"book_details"
),
path
(
'books/<int:pk>/details/'
,
BooksDetail
.
as_view
(),
name
=
"book_details"
),
path
(
'authors/'
,
AuthorView
.
as_view
(),
name
=
"authors"
),
path
(
'authors/'
,
AuthorView
.
as_view
(),
name
=
"authors"
),
path
(
'authors/<int:pk>/details/'
,
AuthorDetail
.
as_view
(),
name
=
"author_details"
),
path
(
'authors/<int:pk>/details/'
,
AuthorDetail
.
as_view
(),
name
=
"author_details"
),
#path for the forms that add
path
(
'books/add'
,
BooksAddView
.
as_view
(),
name
=
'add_books'
),
#path('authors/add'),
]
]
# This might be needed, depending on your Django version
# This might be needed, depending on your Django version
...
...
neptunesy_reading/bookshelf/views.py
View file @
e3dc6a99
...
@@ -12,6 +12,11 @@ class BooksView(ListView):
...
@@ -12,6 +12,11 @@ class BooksView(ListView):
template_name
=
"bookshelf/books.html"
template_name
=
"bookshelf/books.html"
class
BooksAddView
(
ListView
):
model
=
Author
template_name
=
"bookshelf/add-book.html"
class
BooksDetail
(
DetailView
):
class
BooksDetail
(
DetailView
):
model
=
Book
model
=
Book
template_name
=
"bookshelf/book_detais.html"
template_name
=
"bookshelf/book_detais.html"
...
@@ -20,6 +25,10 @@ class BooksDetail(DetailView):
...
@@ -20,6 +25,10 @@ class BooksDetail(DetailView):
class
AuthorView
(
ListView
):
class
AuthorView
(
ListView
):
model
=
Author
model
=
Author
template_name
=
"bookshelf/authors.html"
template_name
=
"bookshelf/authors.html"
class
AuthorAddView
(
ListView
):
model
=
Book
template_name
=
"bookshelf/add-author.html"
class
AuthorDetail
(
DetailView
):
class
AuthorDetail
(
DetailView
):
...
...
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