Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mavlee_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
Mavrick Jordan Lee
mavlee_reading
Commits
809f8544
Commit
809f8544
authored
Mar 27, 2023
by
Mavrick Jordan Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Created admin of bookshelf. Fixed book model in bookshelf and migrated.
parent
4783430e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
2 deletions
+38
-2
admin.py
mavlee_reading/bookshelf/admin.py
+16
-0
0002_rename_books_book.py
...ee_reading/bookshelf/migrations/0002_rename_books_book.py
+17
-0
models.py
mavlee_reading/bookshelf/models.py
+5
-2
db.sqlite3
mavlee_reading/db.sqlite3
+0
-0
No files found.
mavlee_reading/bookshelf/admin.py
View file @
809f8544
from
django.contrib
import
admin
from
django.contrib
import
admin
from
.models
import
Author
,
Book
# Register your models here.
# Register your models here.
class
AuthorAdmin
(
admin
.
ModelAdmin
):
model
=
Author
list_display
=
(
'first_name'
,
'last_name'
,
'age'
,
'nationality'
,
'bio'
)
search_fields
=
(
'first_name'
,
'last_name'
,
'age'
,
'nationality'
)
list_filter
=
(
'first_name'
,
'last_name'
,
'age'
,
'nationality'
)
class
BookAdmin
(
admin
.
ModelAdmin
):
model
=
Book
list_display
=
(
'title'
,
'author'
,
'publisher'
,
'year_published'
,
'ISBN'
,
'blurb'
)
search_fields
=
(
'title'
,
'author'
,
'publisher'
,
'year_published'
,
'ISBN'
)
list_filter
=
(
'title'
,
'author'
,
'publisher'
,
'year_published'
,
'ISBN'
)
admin
.
site
.
register
(
Author
,
AuthorAdmin
)
admin
.
site
.
register
(
Book
,
BookAdmin
)
\ No newline at end of file
mavlee_reading/bookshelf/migrations/0002_rename_books_book.py
0 → 100644
View file @
809f8544
# Generated by Django 3.2 on 2023-03-27 11:57
from
django.db
import
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'bookshelf'
,
'0001_initial'
),
]
operations
=
[
migrations
.
RenameModel
(
old_name
=
'Books'
,
new_name
=
'Book'
,
),
]
mavlee_reading/bookshelf/models.py
View file @
809f8544
...
@@ -12,10 +12,13 @@ class Author(models.Model):
...
@@ -12,10 +12,13 @@ class Author(models.Model):
def
__str__
(
self
):
def
__str__
(
self
):
return
self
.
first_name
+
" "
+
self
.
last_name
return
self
.
first_name
+
" "
+
self
.
last_name
class
Book
s
(
models
.
Model
):
class
Book
(
models
.
Model
):
title
=
models
.
CharField
(
max_length
=
50
)
title
=
models
.
CharField
(
max_length
=
50
)
author
=
models
.
ForeignKey
(
Author
,
on_delete
=
models
.
CASCADE
)
author
=
models
.
ForeignKey
(
Author
,
on_delete
=
models
.
CASCADE
)
publisher
=
models
.
CharField
(
max_length
=
50
)
publisher
=
models
.
CharField
(
max_length
=
50
)
year_published
=
models
.
IntegerField
()
year_published
=
models
.
IntegerField
()
ISBN
=
models
.
CharField
(
max_length
=
13
)
ISBN
=
models
.
CharField
(
max_length
=
13
)
blurb
=
models
.
TextField
(
max_length
=
200
)
blurb
=
models
.
TextField
(
max_length
=
200
)
def
__str__
(
self
):
return
self
.
title
\ No newline at end of file
mavlee_reading/db.sqlite3
View file @
809f8544
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