Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gab_salas_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
Jose Gabriel L. Salas
gab_salas_reading
Commits
9c7e633d
Commit
9c7e633d
authored
Mar 28, 2023
by
Jose Gabriel L. Salas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
set up admin.py
parent
6d751dff
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
43 additions
and
3 deletions
+43
-3
admin.cpython-310.pyc
...salas_reading/bookshelf/__pycache__/admin.cpython-310.pyc
+0
-0
models.cpython-310.pyc
...alas_reading/bookshelf/__pycache__/models.cpython-310.pyc
+0
-0
admin.py
gab_salas_reading/bookshelf/admin.py
+41
-1
models.py
gab_salas_reading/bookshelf/models.py
+1
-1
db.sqlite3
gab_salas_reading/db.sqlite3
+0
-0
settings.py
gab_salas_reading/gab_salas_reading/settings.py
+1
-1
No files found.
gab_salas_reading/bookshelf/__pycache__/admin.cpython-310.pyc
View file @
9c7e633d
No preview for this file type
gab_salas_reading/bookshelf/__pycache__/models.cpython-310.pyc
View file @
9c7e633d
No preview for this file type
gab_salas_reading/bookshelf/admin.py
View file @
9c7e633d
from
django.contrib
import
admin
from
.models
import
Books
,
Author
# Register your models here.
class
AuthorAdmin
(
admin
.
ModelAdmin
):
model
=
Author
search_fields
=
(
'first_name'
,
'last_name'
,
'nationality'
,
)
list_display
=
(
'first_name'
,
'last_name'
,
'age'
,
'nationality'
,
'bio'
,
)
list_filter
=
(
'nationality'
,
'last_name'
,
'first_name'
,
)
fieldsets
=
[
(
'Author'
,
{
'fields'
:
[
(
'first_name'
,
'last_name'
,
),
'age'
,
'nationality'
,
'bio'
]
}),
]
class
BooksAdmin
(
admin
.
ModelAdmin
):
model
=
Books
search_fields
=
(
'title'
,
'author'
,
'ISBN'
,
)
list_display
=
(
'title'
,
'author'
,
'publisher'
,
'year_published'
,
'ISBN'
,
'blurb'
,
)
list_filter
=
(
'title'
,
'author'
,
'ISBN'
,
)
fieldsets
=
[
(
'Books'
,
{
'fields'
:
[
(
'title'
,
'author'
,
),
(
'publisher'
,
'year_published'
,
),
'ISBN'
,
'blurb'
]
}),
]
admin
.
site
.
register
(
Author
,
AuthorAdmin
)
admin
.
site
.
register
(
Books
,
BooksAdmin
)
gab_salas_reading/bookshelf/models.py
View file @
9c7e633d
...
...
@@ -25,5 +25,5 @@ class Books(models.Model):
blurb
=
models
.
TextField
()
def
__str__
(
self
):
return
'{}
:
{}'
.
format
(
self
.
title
,
self
.
author
)
return
'{}
by
{}'
.
format
(
self
.
title
,
self
.
author
)
gab_salas_reading/db.sqlite3
View file @
9c7e633d
No preview for this file type
gab_salas_reading/gab_salas_reading/settings.py
View file @
9c7e633d
...
...
@@ -58,7 +58,7 @@ ROOT_URLCONF = 'gab_salas_reading.urls'
TEMPLATES
=
[
{
'BACKEND'
:
'django.template.backends.django.DjangoTemplates'
,
'DIRS'
:
[],
'DIRS'
:
[
os
.
path
.
join
(
BASE_DIR
,
'templates'
)
],
'APP_DIRS'
:
True
,
'OPTIONS'
:
{
'context_processors'
:
[
...
...
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