Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nicsdevega_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
Nics De Vega
nicsdevega_reading
Commits
afc77108
Commit
afc77108
authored
Apr 25, 2023
by
Nics De Vega
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Created forms and add pages for books and authors
parent
a719b59d
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
85 additions
and
10 deletions
+85
-10
README.txt
README.txt
+3
-2
forms.py
nicsdevega_reading/bookshelf/forms.py
+14
-0
add-author.html
...ega_reading/bookshelf/templates/bookshelf/add-author.html
+13
-0
add-book.html
...evega_reading/bookshelf/templates/bookshelf/add-book.html
+13
-0
add_author.html
...ega_reading/bookshelf/templates/bookshelf/add_author.html
+0
-0
add_book.html
...evega_reading/bookshelf/templates/bookshelf/add_book.html
+0
-0
edit-author.html
...ga_reading/bookshelf/templates/bookshelf/edit-author.html
+14
-0
edit-book.html
...vega_reading/bookshelf/templates/bookshelf/edit-book.html
+14
-0
edit_author.html
...ga_reading/bookshelf/templates/bookshelf/edit_author.html
+0
-0
edit_book.html
...vega_reading/bookshelf/templates/bookshelf/edit_book.html
+0
-0
home.html
nicsdevega_reading/bookshelf/templates/bookshelf/home.html
+2
-2
urls.py
nicsdevega_reading/bookshelf/urls.py
+8
-2
views.py
nicsdevega_reading/bookshelf/views.py
+4
-4
No files found.
README.txt
View file @
afc77108
Denise Nicole H. De Vega
Denise Nicole H. De Vega
211951
2 BSMS CS
2 BSMS CS
CSCI 40 E
CSCI 40 E
Lab 0
3: My Favorite Books and Authors
Lab 0
4: My Favorite Books and Authors v2
March 27
, 2023
April 25
, 2023
This lab activity has been truthfully completed by me.
This lab activity has been truthfully completed by me.
I can say that with full confidence because my slay is too powerful #yasslay.
I can say that with full confidence because my slay is too powerful #yasslay.
<sgd> Denise Nicole H. De Vega, 03/27/2023
<sgd> Denise Nicole H. De Vega, 03/27/2023
\ No newline at end of file
nicsdevega_reading/bookshelf/forms.py
0 → 100644
View file @
afc77108
# app/forms.py
from
django
import
forms
from
.models
import
Book
,
Author
class
BookForm
(
forms
.
ModelForm
):
class
Meta
:
model
=
Book
fields
=
[
'Title'
,
'Author'
,
'Publisher'
,
'Year Published'
,
'ISBN'
,
'Blurb'
]
class
AuthorForm
(
forms
.
ModelForm
):
class
Meta
:
model
=
Author
fields
=
[
'First Name'
,
'Last Name'
,
'Age'
,
'Nationality'
,
'Bio'
]
nicsdevega_reading/bookshelf/templates/bookshelf/add-author.html
0 → 100644
View file @
afc77108
{% extends 'base.html' %}
{% load static %}
{% block title %}Add New Author{% endblock %}
{% block content %}
<br>
<form
action=
"authors/<int:pk>/details/"
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
nicsdevega_reading/bookshelf/templates/bookshelf/add-book.html
0 → 100644
View file @
afc77108
{% extends 'base.html' %}
{% load static %}
{% block title %}Add New Book{% endblock %}
{% block content %}
<br>
<form
action=
"books/<int:pk>/details/"
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
nicsdevega_reading/bookshelf/templates/bookshelf/add_author.html
deleted
100644 → 0
View file @
a719b59d
nicsdevega_reading/bookshelf/templates/bookshelf/add_book.html
deleted
100644 → 0
View file @
a719b59d
nicsdevega_reading/bookshelf/templates/bookshelf/edit-author.html
0 → 100644
View file @
afc77108
{% extends 'base.html' %}
{% load static %}
{% block title %}Edit Author{% endblock %}
{% block content %}
<br>
<form
action=
"/"
method=
"post"
>
{% csrf_token %}
{% for field in form %}
{{field.label}}:{{field}}
<br><br>
{% endfor %}
<input
type=
"submit"
value=
"Submit"
>
</form>
{% endblock %}
\ No newline at end of file
nicsdevega_reading/bookshelf/templates/bookshelf/edit-book.html
0 → 100644
View file @
afc77108
{% extends 'base.html' %}
{% load static %}
{% block title %}Edit Book{% endblock %}
{% block content %}
<br>
<form
action=
"/"
method=
"post"
>
{% csrf_token %}
{% for field in form %}
{{field.label}}:{{field}}
<br><br>
{% endfor %}
<input
type=
"submit"
value=
"Submit"
>
</form>
{% endblock %}
\ No newline at end of file
nicsdevega_reading/bookshelf/templates/bookshelf/edit_author.html
deleted
100644 → 0
View file @
a719b59d
nicsdevega_reading/bookshelf/templates/bookshelf/edit_book.html
deleted
100644 → 0
View file @
a719b59d
nicsdevega_reading/bookshelf/templates/bookshelf/home.html
View file @
afc77108
...
@@ -10,8 +10,8 @@
...
@@ -10,8 +10,8 @@
<a
href=
"../books/"
>
Books
</a>
<a
href=
"../books/"
>
Books
</a>
<a
href=
"../authors/"
>
Authors
</a>
<a
href=
"../authors/"
>
Authors
</a>
<br>
<br>
<a
href=
"../books/add"
>
Add Book
</a>
<a
href=
"../books/add
/
"
>
Add Book
</a>
<a
href=
"../authors/add"
>
Add Author
</a>
<a
href=
"../authors/add
/
"
>
Add Author
</a>
</small>
</small>
</h2>
</h2>
...
...
nicsdevega_reading/bookshelf/urls.py
View file @
afc77108
from
django.urls
import
path
from
django.urls
import
path
from
.views
import
homepage
,
index_view
,
BooksView
,
AuthorsView
,
BooksDetailView
,
AuthorsDetailView
,
BooksCreateView
,
BooksUpdateView
,
AuthorsCreateView
,
AuthorsUpdateView
from
.views
import
(
homepage
,
index_view
,
BooksView
,
AuthorsView
,
BooksDetailView
,
AuthorsDetailView
,
BooksCreateView
,
BooksUpdateView
,
AuthorsCreateView
,
AuthorsUpdateView
)
urlpatterns
=
[
urlpatterns
=
[
path
(
''
,
index_view
,
name
=
'index'
),
path
(
''
,
index_view
,
name
=
'index'
),
path
(
'home/'
,
homepage
,
name
=
'home'
),
path
(
'home/'
,
homepage
,
name
=
'home'
),
...
@@ -9,10 +13,12 @@ urlpatterns = [
...
@@ -9,10 +13,12 @@ urlpatterns = [
path
(
'books/<int:pk>/details/'
,
BooksDetailView
.
as_view
(),
name
=
'book_details'
),
path
(
'books/<int:pk>/details/'
,
BooksDetailView
.
as_view
(),
name
=
'book_details'
),
path
(
'books/add/'
,
BooksCreateView
.
as_view
(),
name
=
'add_book'
),
path
(
'books/add/'
,
BooksCreateView
.
as_view
(),
name
=
'add_book'
),
path
(
'books/<int:pk>/edit/'
,
BooksUpdateView
.
as_view
(),
name
=
'update_book'
),
path
(
'books/<int:pk>/edit/'
,
BooksUpdateView
.
as_view
(),
name
=
'update_book'
),
path
(
'authors/'
,
AuthorsView
.
as_view
(),
name
=
'authors'
),
path
(
'authors/'
,
AuthorsView
.
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
(
'authors/add/'
,
AuthorsCreateView
.
as_view
(),
name
=
'add_author'
),
path
(
'authors/add/'
,
AuthorsCreateView
.
as_view
(),
name
=
'add_author'
),
path
(
'authors/<int:pk>/edit/'
,
BooksUpdateView
.
as_view
(),
name
=
'update_author'
),
path
(
'authors/<int:pk>/edit/'
,
AuthorsUpdateView
.
as_view
(),
name
=
'update_author'
),
]
]
app_name
=
'bookshelf'
app_name
=
'bookshelf'
\ No newline at end of file
nicsdevega_reading/bookshelf/views.py
View file @
afc77108
...
@@ -22,12 +22,12 @@ class BooksDetailView(DetailView):
...
@@ -22,12 +22,12 @@ class BooksDetailView(DetailView):
class
BooksCreateView
(
CreateView
):
class
BooksCreateView
(
CreateView
):
model
=
Book
model
=
Book
fields
=
'__all__'
fields
=
'__all__'
template_name
=
"bookshelf/add
_
book.html"
template_name
=
"bookshelf/add
-
book.html"
class
BooksUpdateView
(
UpdateView
):
class
BooksUpdateView
(
UpdateView
):
model
=
Book
model
=
Book
fields
=
'__all__'
fields
=
'__all__'
template_name
=
"bookshelf/edit
_
book.html"
template_name
=
"bookshelf/edit
-
book.html"
class
AuthorsView
(
ListView
):
class
AuthorsView
(
ListView
):
model
=
Author
model
=
Author
...
@@ -40,9 +40,9 @@ class AuthorsDetailView(DetailView):
...
@@ -40,9 +40,9 @@ class AuthorsDetailView(DetailView):
class
AuthorsCreateView
(
CreateView
):
class
AuthorsCreateView
(
CreateView
):
model
=
Author
model
=
Author
fields
=
'__all__'
fields
=
'__all__'
template_name
=
"bookshelf/add
_
author.html"
template_name
=
"bookshelf/add
-
author.html"
class
AuthorsUpdateView
(
UpdateView
):
class
AuthorsUpdateView
(
UpdateView
):
model
=
Book
model
=
Book
fields
=
'__all__'
fields
=
'__all__'
template_name
=
"bookshelf/edit_author.html"
template_name
=
"bookshelf/edit-author.html"
\ No newline at end of file
\ 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