Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
luigirodriguez_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
Neal Luigi D. Rodriguez
luigirodriguez_reading
Commits
7c7800c1
Commit
7c7800c1
authored
Apr 25, 2023
by
Neal Luigi D. Rodriguez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added new url paths and new author view classes
parent
36255369
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
50 additions
and
7 deletions
+50
-7
README.txt
README.txt
+3
-3
forms.cpython-39.pyc
...riguez_reading/bookshelf/__pycache__/forms.cpython-39.pyc
+0
-0
urls.cpython-39.pyc
...driguez_reading/bookshelf/__pycache__/urls.cpython-39.pyc
+0
-0
views.cpython-39.pyc
...riguez_reading/bookshelf/__pycache__/views.cpython-39.pyc
+0
-0
forms.py
luigirodriguez_reading/bookshelf/forms.py
+7
-0
add-author.html
...uez_reading/bookshelf/templates/bookshelf/add-author.html
+10
-0
add-book.html
...iguez_reading/bookshelf/templates/bookshelf/add-book.html
+0
-0
urls.py
luigirodriguez_reading/bookshelf/urls.py
+6
-3
views.py
luigirodriguez_reading/bookshelf/views.py
+24
-1
db.sqlite3
luigirodriguez_reading/db.sqlite3
+0
-0
No files found.
README.txt
View file @
7c7800c1
Neal Luigi D. Rodriguez
Neal Luigi D. Rodriguez
204374
204374
CSCI 40-F
CSCI 40-F
Lab 0
3
: My Favorite Books and Submission
Lab 0
4
: My Favorite Books and Submission
Date of Submission:
March 30
, 2023
Date of Submission:
April 25
, 2023
This lab was truthfully completed by me.
This lab was truthfully completed by me.
I am the sole contributor and author of
I am the sole contributor and author of
...
@@ -24,4 +24,4 @@ wikipedia and the penguin publishing website
...
@@ -24,4 +24,4 @@ wikipedia and the penguin publishing website
<sgd>
<sgd>
Neal Luigi D. Rodriguez
Neal Luigi D. Rodriguez
March 30, 2023
April 25, 2023
\ No newline at end of file
\ No newline at end of file
luigirodriguez_reading/bookshelf/__pycache__/forms.cpython-39.pyc
0 → 100644
View file @
7c7800c1
File added
luigirodriguez_reading/bookshelf/__pycache__/urls.cpython-39.pyc
View file @
7c7800c1
No preview for this file type
luigirodriguez_reading/bookshelf/__pycache__/views.cpython-39.pyc
View file @
7c7800c1
No preview for this file type
luigirodriguez_reading/bookshelf/forms.py
0 → 100644
View file @
7c7800c1
from
django
import
forms
from
.models
import
Author
,
Books
class
AuthorForm
(
forms
.
ModelForm
):
class
Meta
:
model
=
Author
fields
=
[
'first_name'
,
'last_name'
,
'age'
,
'nationality'
,
'bio'
]
\ No newline at end of file
luigirodriguez_reading/bookshelf/templates/bookshelf/add-author.html
0 → 100644
View file @
7c7800c1
{% extends 'base.html' %}
{% load static %}
{% block title %} Add New Author {% endblock %}
{% block content %}
<form
action=
""
method=
"post"
>
{% csrf token %}
{{ form }}
<input
type=
"submit"
value=
"Submit"
>
</form>
{% endblock %}
\ No newline at end of file
luigirodriguez_reading/bookshelf/templates/bookshelf/add-book.html
0 → 100644
View file @
7c7800c1
luigirodriguez_reading/bookshelf/urls.py
View file @
7c7800c1
...
@@ -2,15 +2,18 @@ from django.urls import path
...
@@ -2,15 +2,18 @@ from django.urls import path
from
.views
import
(
home_view
,
from
.views
import
(
home_view
,
BooksListView
,
BooksDetailView
,
BooksListView
,
BooksDetailView
,
AuthorsListView
,
AuthorsDetailView
AuthorsListView
,
AuthorsDetailView
,
AuthorsCreateView
,
AuthorsUpdateView
)
)
urlpatterns
=
[
urlpatterns
=
[
path
(
'home'
,
home_view
,
name
=
'index'
),
path
(
'home'
,
home_view
,
name
=
'index'
),
path
(
'books'
,
BooksListView
.
as_view
(),
name
=
'books-list'
),
path
(
'books'
,
BooksListView
.
as_view
(),
name
=
'books-list'
),
path
(
'books/<int:pk>'
,
BooksDetailView
.
as_view
(),
name
=
'books-detail'
),
path
(
'books/<int:pk>
/details/
'
,
BooksDetailView
.
as_view
(),
name
=
'books-detail'
),
path
(
'authors'
,
AuthorsListView
.
as_view
(),
name
=
'authors-list'
),
path
(
'authors'
,
AuthorsListView
.
as_view
(),
name
=
'authors-list'
),
path
(
'authors/<int:pk>'
,
AuthorsDetailView
.
as_view
(),
name
=
'authors-detail'
)
path
(
'authors/<pk>/details/'
,
AuthorsDetailView
.
as_view
(),
name
=
'authors-detail'
),
path
(
'authors/add/'
,
AuthorsCreateView
,
name
=
'authors-add'
),
path
(
'authors/<pk>/edit/'
,
AuthorsUpdateView
,
name
=
'authors-edit'
)
]
]
app_name
=
"bookshelf"
app_name
=
"bookshelf"
\ No newline at end of file
luigirodriguez_reading/bookshelf/views.py
View file @
7c7800c1
...
@@ -2,8 +2,12 @@ from django.shortcuts import render
...
@@ -2,8 +2,12 @@ from django.shortcuts import render
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
django.http
import
HttpResponse
from
django.shortcuts
import
render
,
redirect
from
.models
import
Author
,
Books
from
.models
import
Author
,
Books
from
.forms
import
AuthorForm
# Create your views here.
# Create your views here.
def
home_view
(
request
):
def
home_view
(
request
):
...
@@ -20,6 +24,16 @@ class AuthorsDetailView(DetailView):
...
@@ -20,6 +24,16 @@ class AuthorsDetailView(DetailView):
model
=
Author
model
=
Author
template_name
=
'bookshelf/authors_details.html'
template_name
=
'bookshelf/authors_details.html'
class
AuthorsCreateView
(
CreateView
):
model
=
Author
fields
=
'__all__'
template_name
=
'bookshelf/add-author.html'
class
AuthorsUpdateView
(
UpdateView
):
model
=
Author
field
=
'__all__'
template_name
=
'bookshelf/authors_details.html'
class
BooksListView
(
ListView
):
class
BooksListView
(
ListView
):
def
get
(
self
,
request
):
def
get
(
self
,
request
):
books
=
Books
.
objects
.
all
()
books
=
Books
.
objects
.
all
()
...
@@ -31,3 +45,12 @@ class BooksDetailView(DetailView):
...
@@ -31,3 +45,12 @@ class BooksDetailView(DetailView):
model
=
Books
model
=
Books
template_name
=
'bookshelf/book_details.html'
template_name
=
'bookshelf/book_details.html'
def
author_view
(
request
):
if
request
.
method
==
'POST'
:
form
=
AuthorForm
(
request
.
POST
)
if
form
.
is_valid
():
new_author
=
form
.
save
()
return
redirect
(
AuthorsDetailView
,
pk
=
new_author
.
pk
)
else
:
form
=
AuthorForm
()
return
render
(
request
,
'add-author.html'
,
{
'form'
:
form
})
\ No newline at end of file
luigirodriguez_reading/db.sqlite3
View file @
7c7800c1
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