Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
albertgagalac_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
Albert Gagalac
albertgagalac_reading
Commits
51713d1d
Commit
51713d1d
authored
Mar 28, 2023
by
Albert Gagalac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added bookshelf app + author & book models
parent
2cbca803
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
54 additions
and
1 deletion
+54
-1
__init__.cpython-310.pyc
...lbertgagalac_reading/__pycache__/__init__.cpython-310.pyc
+0
-0
settings.cpython-310.pyc
...lbertgagalac_reading/__pycache__/settings.cpython-310.pyc
+0
-0
urls.cpython-310.pyc
...ng/albertgagalac_reading/__pycache__/urls.cpython-310.pyc
+0
-0
wsgi.cpython-310.pyc
...ng/albertgagalac_reading/__pycache__/wsgi.cpython-310.pyc
+0
-0
settings.py
...g/albertgagalac_reading/albertgagalac_reading/settings.py
+5
-1
__init__.py
...galac_reading/albertgagalac_reading/bookshelf/__init__.py
+0
-0
admin.py
...tgagalac_reading/albertgagalac_reading/bookshelf/admin.py
+3
-0
apps.py
...rtgagalac_reading/albertgagalac_reading/bookshelf/apps.py
+6
-0
__init__.py
...ng/albertgagalac_reading/bookshelf/migrations/__init__.py
+0
-0
models.py
...gagalac_reading/albertgagalac_reading/bookshelf/models.py
+34
-0
tests.py
...tgagalac_reading/albertgagalac_reading/bookshelf/tests.py
+3
-0
views.py
...tgagalac_reading/albertgagalac_reading/bookshelf/views.py
+3
-0
db.sqlite3
albertgagalac_reading/albertgagalac_reading/db.sqlite3
+0
-0
No files found.
albertgagalac_reading/albertgagalac_reading/albertgagalac_reading/__pycache__/__init__.cpython-310.pyc
0 → 100644
View file @
51713d1d
File added
albertgagalac_reading/albertgagalac_reading/albertgagalac_reading/__pycache__/settings.cpython-310.pyc
0 → 100644
View file @
51713d1d
File added
albertgagalac_reading/albertgagalac_reading/albertgagalac_reading/__pycache__/urls.cpython-310.pyc
0 → 100644
View file @
51713d1d
File added
albertgagalac_reading/albertgagalac_reading/albertgagalac_reading/__pycache__/wsgi.cpython-310.pyc
0 → 100644
View file @
51713d1d
File added
albertgagalac_reading/albertgagalac_reading/albertgagalac_reading/settings.py
View file @
51713d1d
...
...
@@ -11,6 +11,9 @@ https://docs.djangoproject.com/en/4.1/ref/settings/
"""
from
pathlib
import
Path
from
dotenv
import
load_dotenv
load_dotenv
()
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR
=
Path
(
__file__
)
.
resolve
()
.
parent
.
parent
...
...
@@ -20,7 +23,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent
# See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY
=
"django-insecure-vae3s*l&73wjrxfc=e!2yw8)yr7(h($^*v7q)uw
%*
5+1ddqg$-"
SECRET_KEY
=
os
.
getenv
(
'SECRET_KEY'
)
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG
=
True
...
...
@@ -37,6 +40,7 @@ INSTALLED_APPS = [
"django.contrib.sessions"
,
"django.contrib.messages"
,
"django.contrib.staticfiles"
,
"bookshelf"
]
MIDDLEWARE
=
[
...
...
albertgagalac_reading/albertgagalac_reading/bookshelf/__init__.py
0 → 100644
View file @
51713d1d
albertgagalac_reading/albertgagalac_reading/bookshelf/admin.py
0 → 100644
View file @
51713d1d
from
django.contrib
import
admin
# Register your models here.
albertgagalac_reading/albertgagalac_reading/bookshelf/apps.py
0 → 100644
View file @
51713d1d
from
django.apps
import
AppConfig
class
BookshelfConfig
(
AppConfig
):
default_auto_field
=
"django.db.models.BigAutoField"
name
=
"bookshelf"
albertgagalac_reading/albertgagalac_reading/bookshelf/migrations/__init__.py
0 → 100644
View file @
51713d1d
albertgagalac_reading/albertgagalac_reading/bookshelf/models.py
0 → 100644
View file @
51713d1d
from
django.db
import
models
from
django.core.validators
import
RegexValidator
,
MinLengthValidator
,
MaxLengthValidator
# Create your models here.
class
Author
(
models
.
Model
):
first_name
=
models
.
CharField
(
default
=
""
)
last_name
=
models
.
CharField
(
default
=
""
)
age
=
models
.
PositiveIntegerField
(
default
=
0
)
nationality
=
models
.
CharField
(
default
=
""
,
max_length
=
100
)
bio
=
models
.
TextField
(
default
=
""
,
max_length
=
700
)
def
__str__
(
self
):
return
'{} {}'
.
format
(
self
.
first_name
,
self
.
last_name
)
def
get_absolute_url
(
self
):
return
reverse
(
'author'
,
args
=
[
str
(
self
.
name
)])
class
Books
(
models
.
Model
):
title
=
models
.
CharField
(
default
=
""
)
author
=
models
.
ForeignKey
(
Author
,
on_delete
=
models
.
CASCADE
)
publisher
=
models
.
CharField
(
default
=
""
)
ISBN
=
models
.
PositiveIntegerField
(
validators
=
[
RegexValidator
(
r'^[0-9]*$'
,
message
=
'Only numbers are allowed'
),
MinLengthValidator
(
13
),
MaxLengthValidator
(
13
)])
blurb
=
models
.
TextField
(
default
=
""
,
max_length
=
200
)
def
__str__
(
self
):
return
'{}'
.
format
(
self
.
title
)
def
get_absolute_url
(
self
):
return
reverse
(
'books'
,
args
=
[
str
(
self
.
name
)])
albertgagalac_reading/albertgagalac_reading/bookshelf/tests.py
0 → 100644
View file @
51713d1d
from
django.test
import
TestCase
# Create your tests here.
albertgagalac_reading/albertgagalac_reading/bookshelf/views.py
0 → 100644
View file @
51713d1d
from
django.shortcuts
import
render
# Create your views here.
albertgagalac_reading/albertgagalac_reading/db.sqlite3
0 → 100644
View file @
51713d1d
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