Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mymusiclist
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Brian Guadalupe
mymusiclist
Commits
112824b6
Commit
112824b6
authored
Nov 03, 2017
by
Brian Guadalupe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add admin screen
parent
a9c2f353
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
admin.py
core/admin.py
+18
-0
No files found.
core/admin.py
View file @
112824b6
from
django.contrib
import
admin
from
core.models
import
*
# Register your models here.
class
AlbumAdmin
(
admin
.
ModelAdmin
):
list_display
=
(
'album_name'
,
'artist'
,
'year'
)
class
ArtistAdmin
(
admin
.
ModelAdmin
):
list_display
=
(
'id'
,
'name'
)
class
SongAdmin
(
admin
.
ModelAdmin
):
list_display
=
(
'song_name'
,
'artist_name'
,
'artist_id'
)
def
artist_id
(
self
,
obj
):
return
obj
.
artist
.
id
def
artist_name
(
self
,
obj
):
return
obj
.
artist
.
name
admin
.
site
.
register
(
Album
,
AlbumAdmin
)
admin
.
site
.
register
(
Song
,
SongAdmin
)
admin
.
site
.
register
(
Artist
,
ArtistAdmin
)
\ No newline at end of file
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