Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elaizabolislis_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
Elaiza Bolislis
elaizabolislis_reading
Commits
330e8693
Commit
330e8693
authored
Mar 27, 2023
by
Elaiza Bolislis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Built models, such as Author and Books, for the bookshelf app
parent
0764fc92
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
73 additions
and
1 deletion
+73
-1
models.cpython-310.pyc
...slis_reading/bookshelf/__pycache__/models.cpython-310.pyc
+0
-0
0001_initial.py
elaizabolislis_reading/bookshelf/migrations/0001_initial.py
+39
-0
0001_initial.cpython-310.pyc
...shelf/migrations/__pycache__/0001_initial.cpython-310.pyc
+0
-0
models.py
elaizabolislis_reading/bookshelf/models.py
+34
-1
db.sqlite3
elaizabolislis_reading/db.sqlite3
+0
-0
No files found.
elaizabolislis_reading/bookshelf/__pycache__/models.cpython-310.pyc
View file @
330e8693
No preview for this file type
elaizabolislis_reading/bookshelf/migrations/0001_initial.py
0 → 100644
View file @
330e8693
This diff is collapsed.
Click to expand it.
elaizabolislis_reading/bookshelf/migrations/__pycache__/0001_initial.cpython-310.pyc
0 → 100644
View file @
330e8693
File added
elaizabolislis_reading/bookshelf/models.py
View file @
330e8693
from
django.db
import
models
from
django.core.validators
import
MaxValueValidator
,
MinValueValidator
import
datetime
# 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
.
TextField
(
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
=
150
)
YEAR_PUBLISHED_CHOICES
=
[
(
r
,
r
)
for
r
in
range
(
1000
,
datetime
.
date
.
today
()
.
year
+
1
)
]
year_published
=
models
.
PositiveIntegerField
(
choices
=
YEAR_PUBLISHED_CHOICES
,
default
=
datetime
.
date
.
today
()
.
year
)
ISBN
=
models
.
PositiveIntegerField
(
validators
=
[
MaxValueValidator
(
9999999999999
),
MinValueValidator
(
1000000000000
)],
default
=
1000000000000
)
blurb
=
models
.
TextField
(
max_length
=
1000
)
def
__str__
(
self
):
return
'{} ({}) by {}'
.
format
(
self
.
title
,
self
.
year_published
,
self
.
author
)
elaizabolislis_reading/db.sqlite3
View file @
330e8693
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