Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
chrisolivares_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
Christian Louis Olivares
chrisolivares_reading
Commits
8f051159
Commit
8f051159
authored
Mar 28, 2023
by
Christian Louis Olivares
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
populated data using admin panel
parent
9145e26b
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
71 additions
and
7 deletions
+71
-7
models.cpython-310.pyc
...ares_reading/bookshelf/__pycache__/models.cpython-310.pyc
+0
-0
0003_alter_books_blurb_alter_books_publisher.py
...igrations/0003_alter_books_blurb_alter_books_publisher.py
+24
-0
0004_alter_books_isbn.py
...res_reading/bookshelf/migrations/0004_alter_books_isbn.py
+19
-0
0005_alter_books_isbn.py
...res_reading/bookshelf/migrations/0005_alter_books_isbn.py
+20
-0
0003_alter_books_blurb_alter_books_publisher.cpython-310.pyc
...3_alter_books_blurb_alter_books_publisher.cpython-310.pyc
+0
-0
0004_alter_books_isbn.cpython-310.pyc
...rations/__pycache__/0004_alter_books_isbn.cpython-310.pyc
+0
-0
0005_alter_books_isbn.cpython-310.pyc
...rations/__pycache__/0005_alter_books_isbn.cpython-310.pyc
+0
-0
models.py
chrisolivares_reading/bookshelf/models.py
+8
-7
db.sqlite3
chrisolivares_reading/db.sqlite3
+0
-0
No files found.
chrisolivares_reading/bookshelf/__pycache__/models.cpython-310.pyc
View file @
8f051159
No preview for this file type
chrisolivares_reading/bookshelf/migrations/0003_alter_books_blurb_alter_books_publisher.py
0 → 100644
View file @
8f051159
# Generated by Django 4.1.7 on 2023-03-28 11:35
import
django.core.validators
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'bookshelf'
,
'0002_alter_books_year_published'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'books'
,
name
=
'blurb'
,
field
=
models
.
TextField
(
max_length
=
400
,
validators
=
[
django
.
core
.
validators
.
MinLengthValidator
(
100
)]),
),
migrations
.
AlterField
(
model_name
=
'books'
,
name
=
'publisher'
,
field
=
models
.
CharField
(
default
=
''
,
max_length
=
200
),
),
]
chrisolivares_reading/bookshelf/migrations/0004_alter_books_isbn.py
0 → 100644
View file @
8f051159
# Generated by Django 4.1.7 on 2023-03-28 11:40
import
django.core.validators
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'bookshelf'
,
'0003_alter_books_blurb_alter_books_publisher'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'books'
,
name
=
'ISBN'
,
field
=
models
.
PositiveBigIntegerField
(
validators
=
[
django
.
core
.
validators
.
MinLengthValidator
(
13
),
django
.
core
.
validators
.
MaxLengthValidator
(
13
)]),
),
]
chrisolivares_reading/bookshelf/migrations/0005_alter_books_isbn.py
0 → 100644
View file @
8f051159
# Generated by Django 4.1.7 on 2023-03-28 11:45
import
django.core.validators
from
django.db
import
migrations
,
models
import
re
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'bookshelf'
,
'0004_alter_books_isbn'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'books'
,
name
=
'ISBN'
,
field
=
models
.
CharField
(
default
=
'0000000000000'
,
max_length
=
13
,
validators
=
[
django
.
core
.
validators
.
RegexValidator
(
re
.
compile
(
'^
\\
d+(?:
\\
d+)*
\\
Z'
),
code
=
'invalid'
,
message
=
None
),
django
.
core
.
validators
.
MinLengthValidator
(
13
)]),
),
]
chrisolivares_reading/bookshelf/migrations/__pycache__/0003_alter_books_blurb_alter_books_publisher.cpython-310.pyc
0 → 100644
View file @
8f051159
File added
chrisolivares_reading/bookshelf/migrations/__pycache__/0004_alter_books_isbn.cpython-310.pyc
0 → 100644
View file @
8f051159
File added
chrisolivares_reading/bookshelf/migrations/__pycache__/0005_alter_books_isbn.cpython-310.pyc
0 → 100644
View file @
8f051159
File added
chrisolivares_reading/bookshelf/models.py
View file @
8f051159
from
django.db
import
models
from
django.urls
import
reverse
from
django.core.validators
import
MinLengthValidator
,
M
inValueValidator
,
MaxValueV
alidator
from
django.core.validators
import
MinLengthValidator
,
M
axLengthValidator
,
MaxValueValidator
,
int_list_v
alidator
import
datetime
class
Author
(
models
.
Model
):
...
...
@@ -19,22 +19,23 @@ class Author(models.Model):
class
Books
(
models
.
Model
):
title
=
models
.
Text
Field
(
max_length
=
200
,
default
=
''
)
title
=
models
.
Char
Field
(
max_length
=
200
,
default
=
''
)
author
=
models
.
ForeignKey
(
Author
,
on_delete
=
models
.
PROTECT
,
)
publisher
=
models
.
Text
Field
(
max_length
=
200
,
default
=
''
)
publisher
=
models
.
Char
Field
(
max_length
=
200
,
default
=
''
)
#Source:https://stackoverflow.com/questions/1517474/only-showing-year-in-django-admin-a-yearfield-instead-of-datefield
year_published
=
models
.
IntegerField
(
validators
=
[
MaxValueValidator
(
datetime
.
datetime
.
now
()
.
year
)],
default
=
datetime
.
datetime
.
now
()
.
year
)
#Source: https://stackoverflow.com/questions/30849862/django-max-length-for-integerfield
ISBN
=
models
.
PositiveBigIntegerField
(
validators
=
[
MinValueValidator
(
1000000000000
),
MaxValueValidator
(
9999999999999
)])
blurb
=
models
.
TextField
(
validators
=
[
MinLengthValidator
(
100
)],
max_length
=
200
)
#Source: https://stackoverflow.com/questions/57131043/how-to-make-integer-field-fixed-to-ten-numbers-output-in-models
ISBN
=
models
.
CharField
(
max_length
=
13
,
validators
=
[
int_list_validator
(
sep
=
''
),
MinLengthValidator
(
13
),],
default
=
'0000000000000'
)
blurb
=
models
.
TextField
(
validators
=
[
MinLengthValidator
(
100
)],
max_length
=
400
)
def
__str__
(
self
):
return
'{}
, {} mode
'
.
format
(
self
.
title
,
self
.
author
)
return
'{}
by {}
'
.
format
(
self
.
title
,
self
.
author
)
def
get_absolute_url
(
self
):
return
reverse
(
'location_detail'
,
args
=
[
str
(
self
.
title
)])
...
...
chrisolivares_reading/db.sqlite3
View file @
8f051159
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