Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
carlosoarde_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
Carlos Gabriel Oarde
carlosoarde_reading
Commits
4669fb24
Commit
4669fb24
authored
Mar 27, 2023
by
KaoruSawade
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Built Author and Books models in bookshelf app
parent
626d9388
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
1 deletion
+20
-1
models.py
carlosoarde_reading/bookshelf/models.py
+20
-1
db.sqlite3
carlosoarde_reading/db.sqlite3
+0
-0
No files found.
carlosoarde_reading/bookshelf/models.py
View file @
4669fb24
from
django.db
import
models
from
django.db
import
models
# Create your models here.
class
Author
(
models
.
Model
):
first_name
=
models
.
CharField
(
max_length
=
300
,
default
=
""
)
last_name
=
models
.
CharField
(
max_length
=
300
,
default
=
""
)
age
=
models
.
IntegerField
(
default
=
""
)
nationality
=
models
.
CharField
(
max_length
=
300
,
default
=
""
)
bio
=
models
.
CharField
(
max_length
=
700
,
default
=
""
)
def
__str__
(
self
):
return
'{} {}'
.
format
(
self
.
first_name
,
self
.
last_name
)
class
Books
(
models
.
Model
):
title
=
models
.
CharField
(
max_length
=
300
,
default
=
""
)
author
=
models
.
ForeignKey
(
Author
,
on_delete
=
models
.
CASCADE
)
publisher
=
models
.
CharField
(
max_length
=
300
,
default
=
""
)
year_published
=
models
.
DateField
(
null
=
True
,
default
=
""
)
ISBN
=
models
.
IntegerField
(
max_length
=
13
,
unique
=
True
,
null
=
True
,
default
=
""
)
blurb
=
models
.
TextField
()
def
__str__
(
self
):
return
"
\'
{}
\'
by {}, {}"
.
format
(
self
.
title
,
self
.
author
.
last_name
,
self
.
author
.
first_name
)
carlosoarde_reading/db.sqlite3
View file @
4669fb24
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