Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
alecdayupay_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
Alec Dayupay
alecdayupay_reading
Commits
a1eb2c7b
Commit
a1eb2c7b
authored
Apr 24, 2023
by
Alec Dayupay
Browse files
Options
Browse Files
Download
Plain Diff
Merged master with lab04
parents
e6d7162e
a0d170ab
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
108 additions
and
11 deletions
+108
-11
README.txt
README.txt
+3
-3
urls.cpython-39.pyc
...dayupay_reading/bookshelf/__pycache__/urls.cpython-39.pyc
+0
-0
views.cpython-39.pyc
...ayupay_reading/bookshelf/__pycache__/views.cpython-39.pyc
+0
-0
forms.py
alecdayupay_reading/bookshelf/forms.py
+12
-0
add-author.html
...pay_reading/bookshelf/templates/bookshelf/add-author.html
+12
-0
add-book.html
...yupay_reading/bookshelf/templates/bookshelf/add-book.html
+12
-0
author_details.html
...reading/bookshelf/templates/bookshelf/author_details.html
+2
-1
authors.html
...ayupay_reading/bookshelf/templates/bookshelf/authors.html
+0
-0
book_details.html
...y_reading/bookshelf/templates/bookshelf/book_details.html
+1
-0
books.html
alecdayupay_reading/bookshelf/templates/bookshelf/books.html
+0
-0
edit-book.html
...upay_reading/bookshelf/templates/bookshelf/edit-book.html
+12
-0
edit_author.html
...ay_reading/bookshelf/templates/bookshelf/edit_author.html
+12
-0
home.html
alecdayupay_reading/bookshelf/templates/bookshelf/home.html
+3
-1
urls.py
alecdayupay_reading/bookshelf/urls.py
+11
-5
views.py
alecdayupay_reading/bookshelf/views.py
+28
-1
No files found.
README.txt
View file @
a1eb2c7b
Alec Isaiah R. Dayupay, 211831, CSCI 40-C
Alec Isaiah R. Dayupay, 211831, CSCI 40-C
Lab 0
3: My Favorite Books and Authors
Lab 0
4: My Favorite Books and Authors v2
Date of Submission:
3/27
/2023
Date of Submission:
4/24
/2023
This lab was started, worked on, and finished by me.
This lab was started, worked on, and finished by me.
<sgd> Alec Isaiah R. Dayupay, 3/27/2023
<sgd> Alec Isaiah R. Dayupay, 4/24/2023
\ No newline at end of file
\ No newline at end of file
alecdayupay_reading/bookshelf/__pycache__/urls.cpython-39.pyc
View file @
a1eb2c7b
No preview for this file type
alecdayupay_reading/bookshelf/__pycache__/views.cpython-39.pyc
View file @
a1eb2c7b
No preview for this file type
alecdayupay_reading/bookshelf/forms.py
0 → 100644
View file @
a1eb2c7b
from
django.forms
import
ModelForm
from
.models
import
Books
,
Author
class
BooksForm
(
ModelForm
):
class
Meta
:
model
=
Books
fields
=
'__all__'
class
AuthorForm
(
ModelForm
):
class
Meta
:
model
=
Author
fields
=
'__all__'
\ No newline at end of file
alecdayupay_reading/bookshelf/templates/bookshelf/add-author.html
0 → 100644
View file @
a1eb2c7b
{% extends 'base.html' %}
{% load static %}
{% block title %}Add New Author{% endblock %}
{% block content %}
<form
method=
"POST"
>
{% csrf_token %}
{{ form.as_p }}
<input
type=
"Submit"
value=
"Add Author"
>
</form>
{% endblock %}
\ No newline at end of file
alecdayupay_reading/bookshelf/templates/bookshelf/add-book.html
0 → 100644
View file @
a1eb2c7b
{% extends 'base.html' %}
{% load static %}
{% block title %}Add New Book{% endblock %}
{% block content %}
<form
method=
"POST"
>
{% csrf_token %}
{{ form.as_p }}
<input
type=
"Submit"
value=
"Add Book"
>
</form>
{% endblock %}
\ No newline at end of file
alecdayupay_reading/bookshelf/templates/bookshelf/author_detail.html
→
alecdayupay_reading/bookshelf/templates/bookshelf/author_detail
s
.html
View file @
a1eb2c7b
...
@@ -8,7 +8,8 @@
...
@@ -8,7 +8,8 @@
{% block content %}
{% block content %}
<p>
{{ object.age }}
</p>
<p>
{{ object.age }}
</p>
<p>
{{ object.nationality }}
</p>
<p>
{{ object.nationality }}
</p>
<p>
{{ object.bio }}
</p>
<p>
{{ object.bio }}
</p>
<input
type=
"button"
value=
"Edit Author"
onclick=
"location.href='http://localhost:8000/authors/{{ object.pk }}/edit/'"
/>
<p>
Books by {{ object.first_name }} {{ object.last_name }} I love:
</p>
<p>
Books by {{ object.first_name }} {{ object.last_name }} I love:
</p>
{% for books in object.books_set.all %}
{% for books in object.books_set.all %}
<li>
<li>
...
...
alecdayupay_reading/bookshelf/templates/bookshelf/author
_list
.html
→
alecdayupay_reading/bookshelf/templates/bookshelf/author
s
.html
View file @
a1eb2c7b
File moved
alecdayupay_reading/bookshelf/templates/bookshelf/book
s_detail
.html
→
alecdayupay_reading/bookshelf/templates/bookshelf/book
_details
.html
View file @
a1eb2c7b
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
<p>
{{ object.year_published }}
</p>
<p>
{{ object.year_published }}
</p>
<p>
{{ object.ISBN }}
</p>
<p>
{{ object.ISBN }}
</p>
<p>
{{ object.blurb }}
</p>
<p>
{{ object.blurb }}
</p>
<input
type=
"button"
value=
"Edit Book"
onclick=
"location.href='http://localhost:8000/books/{{ object.pk }}/edit/'"
/>
{% endblock %}
{% endblock %}
{% block links %}
<a
href=
"http://localhost:8000/home/"
>
Home
</a>
<a
href=
"http://localhost:8000/books/"
>
Books
</a>
<a
href=
"http://localhost:8000/authors/"
>
Authors
</a>
{% endblock %}
{% block links %}
<a
href=
"http://localhost:8000/home/"
>
Home
</a>
<a
href=
"http://localhost:8000/books/"
>
Books
</a>
<a
href=
"http://localhost:8000/authors/"
>
Authors
</a>
{% endblock %}
\ No newline at end of file
alecdayupay_reading/bookshelf/templates/bookshelf/books
_list
.html
→
alecdayupay_reading/bookshelf/templates/bookshelf/books.html
View file @
a1eb2c7b
File moved
alecdayupay_reading/bookshelf/templates/bookshelf/edit-book.html
0 → 100644
View file @
a1eb2c7b
{% extends 'base.html' %}
{% load static %}
{% block title %}Edit Book{% endblock %}
{% block content %}
<form
method=
"POST"
>
{% csrf_token %}
{{ form.as_p }}
<input
type=
"Submit"
value=
"Save Changes"
>
</form>
{% endblock %}
\ No newline at end of file
alecdayupay_reading/bookshelf/templates/bookshelf/edit_author.html
0 → 100644
View file @
a1eb2c7b
{% extends 'base.html' %}
{% load static %}
{% block title %}Edit Author{% endblock %}
{% block content %}
<form
method=
"POST"
>
{% csrf_token %}
{{ form.as_p }}
<input
type=
"Submit"
value=
"Save Changes"
>
</form>
{% endblock %}
\ No newline at end of file
alecdayupay_reading/bookshelf/templates/bookshelf/home.html
View file @
a1eb2c7b
...
@@ -12,4 +12,6 @@
...
@@ -12,4 +12,6 @@
</p>
</p>
{% endblock %}
{% endblock %}
{% block links %}
<a
href=
"http://localhost:8000/books/"
>
Books
</a>
<a
href=
"http://localhost:8000/authors/"
>
Authors
</a>
{% endblock %}
{% block links %}
<a
href=
"http://localhost:8000/books/"
>
Books
</a>
<a
href=
"http://localhost:8000/authors/"
>
Authors
</a>
\ No newline at end of file
<a
href=
"http://localhost:8000/books/add/"
>
Add Book
</a>
<a
href=
"http://localhost:8000/authors/add/"
>
Add Author
</a>
{% endblock %}
\ No newline at end of file
alecdayupay_reading/bookshelf/urls.py
View file @
a1eb2c7b
from
django.urls
import
path
from
django.urls
import
path
from
.
import
views
from
.
import
views
from
.views
import
BooksListView
,
BooksDetailView
,
AuthorListView
,
AuthorDetailView
from
.views
import
(
BooksListView
,
BooksCreateView
,
BooksDetailView
,
BooksUpdateView
,
AuthorListView
,
AuthorCreateView
,
AuthorDetailView
,
AuthorUpdateView
)
urlpatterns
=
[
urlpatterns
=
[
path
(
'home/'
,
views
.
home
,
name
=
"home"
),
path
(
'home/'
,
views
.
home
,
name
=
"home"
),
path
(
'books/'
,
BooksListView
.
as_view
(),
name
=
"books_list"
),
path
(
'books/<int:pk>/details/'
,
BooksDetailView
.
as_view
(),
name
=
"books_detail"
),
path
(
'books/'
,
BooksListView
.
as_view
(),
name
=
"books"
),
path
(
'authors/'
,
AuthorListView
.
as_view
(),
name
=
"author_list"
),
path
(
'books/add/'
,
BooksCreateView
.
as_view
(),
name
=
"add-book"
),
path
(
'authors/<int:pk>/details/'
,
AuthorDetailView
.
as_view
(),
name
=
"author_detail"
)
path
(
'books/<int:pk>/details/'
,
BooksDetailView
.
as_view
(),
name
=
"book_details"
),
path
(
'books/<int:pk>/edit/'
,
BooksUpdateView
.
as_view
(),
name
=
"edit-book"
),
path
(
'authors/'
,
AuthorListView
.
as_view
(),
name
=
"authors"
),
path
(
'authors/add/'
,
AuthorCreateView
.
as_view
(),
name
=
"add-author"
),
path
(
'authors/<int:pk>/details/'
,
AuthorDetailView
.
as_view
(),
name
=
"author_details"
),
path
(
'authors/<int:pk>/edit/'
,
AuthorUpdateView
.
as_view
(),
name
=
"edit_author"
),
]
]
\ No newline at end of file
alecdayupay_reading/bookshelf/views.py
View file @
a1eb2c7b
from
django.shortcuts
import
render
from
django.shortcuts
import
render
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
def
home
(
request
):
def
home
(
request
):
return
render
(
request
,
"bookshelf/home.html"
)
return
render
(
request
,
"bookshelf/home.html"
)
class
BooksListView
(
ListView
):
class
BooksListView
(
ListView
):
model
=
Books
model
=
Books
template_name
=
'bookshelf/books.html'
class
BooksCreateView
(
CreateView
):
model
=
Books
fields
=
'__all__'
template_name
=
'bookshelf/add-book.html'
class
BooksDetailView
(
DetailView
):
class
BooksDetailView
(
DetailView
):
model
=
Books
model
=
Books
template_name
=
'bookshelf/book_details.html'
class
BooksUpdateView
(
UpdateView
):
model
=
Books
fields
=
'__all__'
template_name
=
'bookshelf/edit-book.html'
class
AuthorListView
(
ListView
):
class
AuthorListView
(
ListView
):
model
=
Author
model
=
Author
template_name
=
'bookshelf/authors.html'
class
AuthorCreateView
(
CreateView
):
model
=
Author
fields
=
'__all__'
template_name
=
'bookshelf/add-author.html'
class
AuthorDetailView
(
DetailView
):
class
AuthorDetailView
(
DetailView
):
model
=
Author
model
=
Author
\ No newline at end of file
template_name
=
'bookshelf/author_details.html'
class
AuthorUpdateView
(
UpdateView
):
model
=
Author
fields
=
'__all__'
template_name
=
'bookshelf/edit_author.html'
\ 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