Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
justinreyes_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
Justin Reyes
justinreyes_reading
Commits
a04ee101
Commit
a04ee101
authored
Mar 27, 2023
by
justin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added new blurb field for Books
parent
08ab2928
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
0 deletions
+25
-0
admin.py
justinreyes_reading/bookshelf/admin.py
+6
-0
0003_books_blurb.py
justinreyes_reading/bookshelf/migrations/0003_books_blurb.py
+18
-0
models.py
justinreyes_reading/bookshelf/models.py
+1
-0
db.sqlite3
justinreyes_reading/db.sqlite3
+0
-0
No files found.
justinreyes_reading/bookshelf/admin.py
View file @
a04ee101
...
@@ -31,6 +31,7 @@ class BooksAdmin(admin.ModelAdmin):
...
@@ -31,6 +31,7 @@ class BooksAdmin(admin.ModelAdmin):
"publisher"
,
"publisher"
,
"year_published"
,
"year_published"
,
"isbn"
,
"isbn"
,
"shortened_blurb"
,
)
)
search_fields
=
(
search_fields
=
(
"title"
,
"title"
,
...
@@ -43,6 +44,11 @@ class BooksAdmin(admin.ModelAdmin):
...
@@ -43,6 +44,11 @@ class BooksAdmin(admin.ModelAdmin):
"author"
,
"author"
,
)
)
def
shortened_blurb
(
self
,
obj
):
return
obj
.
blurb
[:
50
]
+
"..."
shortened_blurb
.
short_description
=
"Blurb"
class
BooksInline
(
admin
.
StackedInline
):
class
BooksInline
(
admin
.
StackedInline
):
model
=
Books
model
=
Books
...
...
justinreyes_reading/bookshelf/migrations/0003_books_blurb.py
0 → 100644
View file @
a04ee101
# Generated by Django 4.1.7 on 2023-03-27 07:06
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'bookshelf'
,
'0002_alter_books_isbn'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'books'
,
name
=
'blurb'
,
field
=
models
.
TextField
(
blank
=
True
),
),
]
justinreyes_reading/bookshelf/models.py
View file @
a04ee101
...
@@ -27,6 +27,7 @@ class Books(models.Model):
...
@@ -27,6 +27,7 @@ class Books(models.Model):
)
)
year_published
=
models
.
IntegerField
(
default
=
0
)
year_published
=
models
.
IntegerField
(
default
=
0
)
isbn
=
models
.
PositiveBigIntegerField
(
validators
=
[
validate_isbn
])
isbn
=
models
.
PositiveBigIntegerField
(
validators
=
[
validate_isbn
])
blurb
=
models
.
TextField
(
blank
=
True
)
def
__str__
(
self
):
def
__str__
(
self
):
return
self
.
title
return
self
.
title
justinreyes_reading/db.sqlite3
View file @
a04ee101
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