Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
layvillanueva_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
Layla Mikel Villanueva
layvillanueva_reading
Commits
c6f06264
Commit
c6f06264
authored
Mar 28, 2023
by
Layla Mikel Villanueva
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update README, create models, and populate data
parent
5d71319f
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
137 additions
and
1 deletion
+137
-1
README.txt
README.txt
+5
-0
__init__.py
layvillanueva_reading/bookshelf/__init__.py
+0
-0
admin.py
layvillanueva_reading/bookshelf/admin.py
+42
-0
apps.py
layvillanueva_reading/bookshelf/apps.py
+6
-0
0001_initial.py
layvillanueva_reading/bookshelf/migrations/0001_initial.py
+38
-0
__init__.py
layvillanueva_reading/bookshelf/migrations/__init__.py
+0
-0
models.py
layvillanueva_reading/bookshelf/models.py
+25
-0
tests.py
layvillanueva_reading/bookshelf/tests.py
+3
-0
urls.py
layvillanueva_reading/bookshelf/urls.py
+9
-0
views.py
layvillanueva_reading/bookshelf/views.py
+6
-0
db.sqlite3
layvillanueva_reading/db.sqlite3
+0
-0
settings.py
layvillanueva_reading/layvillanueva_reading/settings.py
+1
-0
urls.py
layvillanueva_reading/layvillanueva_reading/urls.py
+2
-1
No files found.
README.txt
View file @
c6f06264
Layla Mikel Villanueva, 216288, CSCI 40-F
Lab 03: My Favorite Books and Authors
March 28, 2023
I have followed and complied with the instructions on the specifications and did the entire lab all by myself.
<sgd> Layla Mikel Villanueva, March 28, 2023
\ No newline at end of file
layvillanueva_reading/bookshelf/__init__.py
0 → 100644
View file @
c6f06264
layvillanueva_reading/bookshelf/admin.py
0 → 100644
View file @
c6f06264
from
django.contrib
import
admin
from
.models
import
Author
,
Books
# Register your models here.
class
AuthorAdmin
(
admin
.
ModelAdmin
):
model
=
Author
search_fields
=
(
'first_name'
,
'last_name'
)
list_display
=
(
'first_name'
,
'last_name'
,
'age'
,
'nationality'
,
'bio'
)
list_filter
=
(
'first_name'
,
'last_name'
,
'nationality'
)
fieldsets
=
[
(
'Author Data'
,
{
'fields'
:
[
(
'first_name'
,
'last_name'
),
(
'age'
,
'nationality'
),
'bio'
]
}),
]
class
BooksAdmin
(
admin
.
ModelAdmin
):
model
=
Books
search_fields
=
(
'title'
,
'author'
,
'publisher'
)
list_display
=
(
'title'
,
'author'
,
'publisher'
,
'year_published'
,
'ISBN'
,
'blurb'
)
list_filter
=
(
'author'
,
'publisher'
,
'year_published'
)
fieldsets
=
[
(
'Books Data'
,
{
'fields'
:
[
(
'title'
,
'author'
),
(
'publisher'
,
'year_published'
,
'ISBN'
),
'blurb'
]
}),
]
admin
.
site
.
register
(
Author
,
AuthorAdmin
)
admin
.
site
.
register
(
Books
,
BooksAdmin
)
\ No newline at end of file
layvillanueva_reading/bookshelf/apps.py
0 → 100644
View file @
c6f06264
from
django.apps
import
AppConfig
class
BookshelfConfig
(
AppConfig
):
default_auto_field
=
'django.db.models.BigAutoField'
name
=
'bookshelf'
layvillanueva_reading/bookshelf/migrations/0001_initial.py
0 → 100644
View file @
c6f06264
# Generated by Django 4.1.7 on 2023-03-28 08:16
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
initial
=
True
dependencies
=
[
]
operations
=
[
migrations
.
CreateModel
(
name
=
'Author'
,
fields
=
[
(
'id'
,
models
.
BigAutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'first_name'
,
models
.
CharField
(
max_length
=
255
)),
(
'last_name'
,
models
.
CharField
(
max_length
=
255
)),
(
'age'
,
models
.
IntegerField
()),
(
'nationality'
,
models
.
CharField
(
max_length
=
255
)),
(
'bio'
,
models
.
CharField
(
max_length
=
700
)),
],
),
migrations
.
CreateModel
(
name
=
'Books'
,
fields
=
[
(
'id'
,
models
.
BigAutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'title'
,
models
.
CharField
(
max_length
=
255
)),
(
'publisher'
,
models
.
CharField
(
max_length
=
255
)),
(
'year_published'
,
models
.
IntegerField
()),
(
'ISBN'
,
models
.
CharField
(
max_length
=
13
)),
(
'blurb'
,
models
.
TextField
()),
(
'author'
,
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'bookshelf.author'
)),
],
),
]
layvillanueva_reading/bookshelf/migrations/__init__.py
0 → 100644
View file @
c6f06264
layvillanueva_reading/bookshelf/models.py
0 → 100644
View file @
c6f06264
from
django.db
import
models
# Create your models here.
class
Author
(
models
.
Model
):
first_name
=
models
.
CharField
(
max_length
=
255
)
last_name
=
models
.
CharField
(
max_length
=
255
)
age
=
models
.
IntegerField
()
nationality
=
models
.
CharField
(
max_length
=
255
)
bio
=
models
.
CharField
(
max_length
=
700
)
def
__str__
(
self
):
return
'{} {}'
.
format
(
self
.
first_name
,
self
.
last_name
)
class
Books
(
models
.
Model
):
title
=
models
.
CharField
(
max_length
=
255
)
author
=
models
.
ForeignKey
(
Author
,
on_delete
=
models
.
CASCADE
)
publisher
=
models
.
CharField
(
max_length
=
255
)
year_published
=
models
.
IntegerField
()
ISBN
=
models
.
CharField
(
max_length
=
13
)
blurb
=
models
.
TextField
()
def
__str__
(
self
):
return
'{}'
.
format
(
self
.
title
)
\ No newline at end of file
layvillanueva_reading/bookshelf/tests.py
0 → 100644
View file @
c6f06264
from
django.test
import
TestCase
# Create your tests here.
layvillanueva_reading/bookshelf/urls.py
0 → 100644
View file @
c6f06264
from
django.urls
import
path
from
.views
import
index
urlpatterns
=
[
path
(
''
,
index
,
name
=
'index'
),
]
app_name
=
"bookshelf"
\ No newline at end of file
layvillanueva_reading/bookshelf/views.py
0 → 100644
View file @
c6f06264
from
django.shortcuts
import
render
from
django.http
import
HttpResponse
def
index
(
request
):
return
HttpResponse
(
"Welcome to Lay's Reading Nook!"
)
\ No newline at end of file
layvillanueva_reading/db.sqlite3
View file @
c6f06264
No preview for this file type
layvillanueva_reading/layvillanueva_reading/settings.py
View file @
c6f06264
...
@@ -41,6 +41,7 @@ INSTALLED_APPS = [
...
@@ -41,6 +41,7 @@ INSTALLED_APPS = [
'django.contrib.sessions'
,
'django.contrib.sessions'
,
'django.contrib.messages'
,
'django.contrib.messages'
,
'django.contrib.staticfiles'
,
'django.contrib.staticfiles'
,
'bookshelf'
]
]
MIDDLEWARE
=
[
MIDDLEWARE
=
[
...
...
layvillanueva_reading/layvillanueva_reading/urls.py
View file @
c6f06264
...
@@ -14,8 +14,9 @@ Including another URLconf
...
@@ -14,8 +14,9 @@ Including another URLconf
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
"""
from
django.contrib
import
admin
from
django.contrib
import
admin
from
django.urls
import
path
from
django.urls
import
include
,
path
urlpatterns
=
[
urlpatterns
=
[
path
(
'bookshelf/'
,
include
(
'bookshelf.urls'
,
namespace
=
"bookshelf"
)),
path
(
'admin/'
,
admin
.
site
.
urls
),
path
(
'admin/'
,
admin
.
site
.
urls
),
]
]
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