Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
rachpurisima_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
Rachel
rachpurisima_reading
Commits
cf9ca778
Commit
cf9ca778
authored
Mar 28, 2023
by
rachbit
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
created app bookshelf and implemented models
parent
7ec30b9a
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
55 additions
and
1 deletion
+55
-1
__init__.py
rachpurisima_reading/bookshelf/__init__.py
+0
-0
admin.py
rachpurisima_reading/bookshelf/admin.py
+3
-0
apps.py
rachpurisima_reading/bookshelf/apps.py
+6
-0
__init__.py
rachpurisima_reading/bookshelf/migrations/__init__.py
+0
-0
models.py
rachpurisima_reading/bookshelf/models.py
+24
-0
tests.py
rachpurisima_reading/bookshelf/tests.py
+3
-0
urls.py
rachpurisima_reading/bookshelf/urls.py
+8
-0
views.py
rachpurisima_reading/bookshelf/views.py
+7
-0
settings.py
rachpurisima_reading/rachpurisima_reading/settings.py
+2
-0
urls.py
rachpurisima_reading/rachpurisima_reading/urls.py
+2
-1
No files found.
rachpurisima_reading/bookshelf/__init__.py
0 → 100644
View file @
cf9ca778
rachpurisima_reading/bookshelf/admin.py
0 → 100644
View file @
cf9ca778
from
django.contrib
import
admin
# Register your models here.
rachpurisima_reading/bookshelf/apps.py
0 → 100644
View file @
cf9ca778
from
django.apps
import
AppConfig
class
BookshelfConfig
(
AppConfig
):
default_auto_field
=
'django.db.models.BigAutoField'
name
=
'bookshelf'
rachpurisima_reading/bookshelf/migrations/__init__.py
0 → 100644
View file @
cf9ca778
rachpurisima_reading/bookshelf/models.py
0 → 100644
View file @
cf9ca778
from
django.db
import
models
from
django.core.validators
import
MinLengthValidator
,
RegexValidator
class
Author
(
models
.
Model
):
first_name
=
models
.
CharField
(
max_length
=
100
)
last_name
=
models
.
CharField
(
max_length
=
100
)
age
=
models
.
IntegerField
()
nationality
=
models
.
CharField
(
max_length
=
100
)
bio
=
models
.
TextField
()
def
__str__
(
self
):
return
'{} {}'
.
format
(
self
.
first_name
,
self
.
last_name
)
class
Books
(
models
.
Model
):
title
=
models
.
CharField
(
max_length
=
100
)
author
=
models
.
ForeignKey
(
Author
,
on_delete
=
models
.
CASCADE
,
default
=
""
)
publisher
=
models
.
CharField
(
max_length
=
100
)
year_published
=
models
.
IntegerField
(
validators
=
[
MinValueValidator
(
0
),
MaxValueValidator
(
2023
)])
ISBN
=
models
.
CharField
(
primary_key
=
True
,
max_length
=
13
,
validators
=
[
MinLengthValidator
(
13
),
RegexValidator
(
r'^\d{1,10}$'
)])
def
__str__
(
self
):
return
'{}'
.
format
(
self
.
title
)
rachpurisima_reading/bookshelf/tests.py
0 → 100644
View file @
cf9ca778
from
django.test
import
TestCase
# Create your tests here.
rachpurisima_reading/bookshelf/urls.py
0 → 100644
View file @
cf9ca778
from
django.urls
import
path
from
.views
import
index
urlpatterns
=
[
path
(
''
,
index
,
name
=
'index'
),
]
# This might be needed, depending on your Django version
app_name
=
"bookshelf"
rachpurisima_reading/bookshelf/views.py
0 → 100644
View file @
cf9ca778
from
django.shortcuts
import
render
from
django.http
import
HttpResponse
# Create your views here.
def
index
(
request
):
return
HttpResponse
(
'bookshelf view'
)
rachpurisima_reading/rachpurisima_reading/settings.py
View file @
cf9ca778
...
...
@@ -40,6 +40,8 @@ INSTALLED_APPS = [
'django.contrib.sessions'
,
'django.contrib.messages'
,
'django.contrib.staticfiles'
,
'bookshelf'
,
]
MIDDLEWARE
=
[
...
...
rachpurisima_reading/rachpurisima_reading/urls.py
View file @
cf9ca778
...
...
@@ -14,8 +14,9 @@ Including another URLconf
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from
django.contrib
import
admin
from
django.urls
import
path
from
django.urls
import
path
,
include
urlpatterns
=
[
path
(
'admin/'
,
admin
.
site
.
urls
),
path
(
''
,
include
(
'bookshelf.urls'
,
namespace
=
'bookshelf'
)),
]
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