Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nich_pardines_music
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
Nicholo Patrick C. Pardines
nich_pardines_music
Commits
49afebd6
Commit
49afebd6
authored
Feb 20, 2023
by
Nicholo Pardines
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added sensible string representations to the homepage models, improved admin panel usability
parent
e4aecfb9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
1 deletion
+9
-1
admin.cpython-38.pyc
homepage/__pycache__/admin.cpython-38.pyc
+0
-0
models.cpython-38.pyc
homepage/__pycache__/models.cpython-38.pyc
+0
-0
admin.py
homepage/admin.py
+3
-1
models.py
homepage/models.py
+6
-0
No files found.
homepage/__pycache__/admin.cpython-38.pyc
View file @
49afebd6
No preview for this file type
homepage/__pycache__/models.cpython-38.pyc
View file @
49afebd6
No preview for this file type
homepage/admin.py
View file @
49afebd6
...
@@ -5,11 +5,13 @@ from .models import Song, Album, Artist
...
@@ -5,11 +5,13 @@ from .models import Song, Album, Artist
class
SongAdmin
(
admin
.
ModelAdmin
):
class
SongAdmin
(
admin
.
ModelAdmin
):
model
=
Song
model
=
Song
list_display
=
(
'song_title'
,
'song_length'
,
'lyrics'
,
'music_video'
)
list_display
=
(
'song_title'
,
'song_length'
,
'lyrics'
,
'music_video'
)
fields
=
(
'song_title'
,
'song_length'
,
'lyrics'
,
'music_video'
,)
fields
=
(
'song_title'
,
'song_length'
,
'lyrics'
,
'music_video'
,
'artist'
)
search_fields
=
(
'song_title'
,
'lyrics'
)
search_fields
=
(
'song_title'
,
'lyrics'
)
list_filter
=
(
'song_title'
,)
list_filter
=
(
'song_title'
,)
class
ArtistAdmin
(
admin
.
ModelAdmin
):
class
ArtistAdmin
(
admin
.
ModelAdmin
):
def
__str__
(
self
)
->
str
:
return
Artist
.
artist_name
model
=
Artist
model
=
Artist
fields
=
(
'artist_name'
,
'birth_name'
,
'monthly_listeners'
,
'bio'
,)
fields
=
(
'artist_name'
,
'birth_name'
,
'monthly_listeners'
,
'bio'
,)
list_display
=
(
'artist_name'
,
'birth_name'
,
'monthly_listeners'
)
list_display
=
(
'artist_name'
,
'birth_name'
,
'monthly_listeners'
)
...
...
homepage/models.py
View file @
49afebd6
...
@@ -17,12 +17,16 @@ from django.db import models
...
@@ -17,12 +17,16 @@ from django.db import models
# * album
# * album
# * song_length
# * song_length
class
Artist
(
models
.
Model
):
class
Artist
(
models
.
Model
):
def
__str__
(
self
)
->
str
:
return
self
.
artist_name
artist_name
=
models
.
CharField
(
max_length
=
50
,
default
=
""
)
artist_name
=
models
.
CharField
(
max_length
=
50
,
default
=
""
)
birth_name
=
models
.
CharField
(
max_length
=
50
,
default
=
""
)
birth_name
=
models
.
CharField
(
max_length
=
50
,
default
=
""
)
bio
=
models
.
CharField
(
max_length
=
700
,
default
=
""
)
bio
=
models
.
CharField
(
max_length
=
700
,
default
=
""
)
monthly_listeners
=
models
.
IntegerField
(
default
=
0
)
monthly_listeners
=
models
.
IntegerField
(
default
=
0
)
class
Album
(
models
.
Model
):
class
Album
(
models
.
Model
):
def
__str__
(
self
)
->
str
:
return
self
.
album_name
album_name
=
models
.
CharField
(
max_length
=
50
)
album_name
=
models
.
CharField
(
max_length
=
50
)
artist
=
models
.
ForeignKey
(
Artist
,
on_delete
=
models
.
CASCADE
,
default
=
None
,
null
=
True
,
blank
=
True
)
artist
=
models
.
ForeignKey
(
Artist
,
on_delete
=
models
.
CASCADE
,
default
=
None
,
null
=
True
,
blank
=
True
)
description
=
models
.
CharField
(
max_length
=
50
)
description
=
models
.
CharField
(
max_length
=
50
)
...
@@ -31,6 +35,8 @@ class Album(models.Model):
...
@@ -31,6 +35,8 @@ class Album(models.Model):
song_count
=
models
.
IntegerField
(
default
=
0
)
song_count
=
models
.
IntegerField
(
default
=
0
)
class
Song
(
models
.
Model
):
class
Song
(
models
.
Model
):
def
__str__
(
self
)
->
str
:
return
self
.
song_title
song_title
=
models
.
CharField
(
max_length
=
50
,
default
=
""
)
song_title
=
models
.
CharField
(
max_length
=
50
,
default
=
""
)
artist
=
models
.
ForeignKey
(
Artist
,
on_delete
=
models
.
CASCADE
,
default
=
None
,
null
=
True
,
blank
=
True
)
artist
=
models
.
ForeignKey
(
Artist
,
on_delete
=
models
.
CASCADE
,
default
=
None
,
null
=
True
,
blank
=
True
)
album
=
models
.
ForeignKey
(
Album
,
on_delete
=
models
.
CASCADE
,
default
=
None
,
null
=
True
,
blank
=
True
)
album
=
models
.
ForeignKey
(
Album
,
on_delete
=
models
.
CASCADE
,
default
=
None
,
null
=
True
,
blank
=
True
)
...
...
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