Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
brevinque_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
Nate Brevin A. Que
brevinque_reading
Commits
c28810f6
Commit
c28810f6
authored
Mar 27, 2023
by
Nate Brevin A. Que
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Created the 'bookshelf' Django app and built its corresponding models.
parent
e4f5b9cc
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
84 additions
and
0 deletions
+84
-0
__init__.py
brevinque_reading/bookshelf/__init__.py
+0
-0
admin.py
brevinque_reading/bookshelf/admin.py
+3
-0
apps.py
brevinque_reading/bookshelf/apps.py
+6
-0
0001_initial.py
brevinque_reading/bookshelf/migrations/0001_initial.py
+38
-0
__init__.py
brevinque_reading/bookshelf/migrations/__init__.py
+0
-0
models.py
brevinque_reading/bookshelf/models.py
+30
-0
tests.py
brevinque_reading/bookshelf/tests.py
+3
-0
views.py
brevinque_reading/bookshelf/views.py
+3
-0
settings.py
brevinque_reading/brevinque_reading/settings.py
+1
-0
db.sqlite3
brevinque_reading/db.sqlite3
+0
-0
No files found.
brevinque_reading/bookshelf/__init__.py
0 → 100644
View file @
c28810f6
brevinque_reading/bookshelf/admin.py
0 → 100644
View file @
c28810f6
from
django.contrib
import
admin
# Register your models here.
brevinque_reading/bookshelf/apps.py
0 → 100644
View file @
c28810f6
from
django.apps
import
AppConfig
class
BookshelfConfig
(
AppConfig
):
default_auto_field
=
'django.db.models.BigAutoField'
name
=
'bookshelf'
brevinque_reading/bookshelf/migrations/0001_initial.py
0 → 100644
View file @
c28810f6
# Generated by Django 3.2 on 2023-03-27 08:20
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
=
100
)),
(
'last_name'
,
models
.
CharField
(
max_length
=
50
)),
(
'age'
,
models
.
IntegerField
()),
(
'nationality'
,
models
.
CharField
(
max_length
=
100
)),
(
'bio'
,
models
.
TextField
(
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
.
CharField
(
max_length
=
4
)),
(
'ISBN'
,
models
.
CharField
(
max_length
=
13
)),
(
'blurb'
,
models
.
CharField
(
max_length
=
200
)),
(
'author'
,
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'bookshelf.author'
)),
],
),
]
brevinque_reading/bookshelf/migrations/__init__.py
0 → 100644
View file @
c28810f6
brevinque_reading/bookshelf/models.py
0 → 100644
View file @
c28810f6
from
django.db
import
models
class
Author
(
models
.
Model
):
first_name
=
models
.
CharField
(
max_length
=
100
)
last_name
=
models
.
CharField
(
max_length
=
50
)
age
=
models
.
IntegerField
()
nationality
=
models
.
CharField
(
max_length
=
100
)
bio
=
models
.
TextField
(
max_length
=
700
)
def
__str__
(
self
):
return
'{} {}'
.
format
(
self
.
first_name
,
self
.
last_name
)
def
get_absolute_url
(
self
):
return
reverse
(
'author_detail'
,
args
=
[
str
(
self
)])
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
.
CharField
(
max_length
=
4
)
ISBN
=
models
.
CharField
(
max_length
=
13
)
blurb
=
models
.
CharField
(
max_length
=
200
)
def
__str__
(
self
):
return
'{} by {}'
.
format
(
self
.
title
,
self
.
author
)
def
get_absolute_url
(
self
):
return
reverse
(
'books_detail'
,
args
=
[
str
(
self
)])
\ No newline at end of file
brevinque_reading/bookshelf/tests.py
0 → 100644
View file @
c28810f6
from
django.test
import
TestCase
# Create your tests here.
brevinque_reading/bookshelf/views.py
0 → 100644
View file @
c28810f6
from
django.shortcuts
import
render
# Create your views here.
brevinque_reading/brevinque_reading/settings.py
View file @
c28810f6
...
...
@@ -42,6 +42,7 @@ INSTALLED_APPS = [
'django.contrib.sessions'
,
'django.contrib.messages'
,
'django.contrib.staticfiles'
,
'bookshelf'
,
]
MIDDLEWARE
=
[
...
...
brevinque_reading/db.sqlite3
0 → 100644
View file @
c28810f6
File added
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