Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mavlee_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
Mavrick Jordan Lee
mavlee_music
Commits
d98df4ab
Commit
d98df4ab
authored
Feb 21, 2023
by
Mavrick Jordan Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed admin.py and models.py
parent
5b4b9b50
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
14 deletions
+23
-14
db.sqlite3
mavlee_music/db.sqlite3
+0
-0
admin.cpython-39.pyc
mavlee_music/homepage/__pycache__/admin.cpython-39.pyc
+0
-0
models.cpython-39.pyc
mavlee_music/homepage/__pycache__/models.cpython-39.pyc
+0
-0
admin.py
mavlee_music/homepage/admin.py
+12
-12
models.py
mavlee_music/homepage/models.py
+11
-2
No files found.
mavlee_music/db.sqlite3
View file @
d98df4ab
No preview for this file type
mavlee_music/homepage/__pycache__/admin.cpython-39.pyc
View file @
d98df4ab
No preview for this file type
mavlee_music/homepage/__pycache__/models.cpython-39.pyc
View file @
d98df4ab
No preview for this file type
mavlee_music/homepage/admin.py
View file @
d98df4ab
...
...
@@ -6,22 +6,22 @@ from .models import Artist, Album, Song
class
ArtistAdmin
(
admin
.
ModelAdmin
):
model
=
Artist
list_display
=
(
'artist
name'
,
'birth name'
,
'monthly listeners'
)
search_fields
=
(
'artist
name'
,
'birth name'
)
list_filter
=
(
'artist
name'
,
'birth name'
)
list_display
=
(
'artist
_name'
,
'birth_name'
,
'monthly_listeners'
,
)
search_fields
=
(
'artist
_name'
,
'birth_name'
,
)
list_filter
=
(
'artist
_name'
,
'birth_name'
,
)
class
AlbumAdmin
(
admin
.
ModelAdmin
):
model
=
Album
list_display
=
(
'album
name'
,
'description'
,
'release date'
,
'label'
,
'song count'
)
search_fields
=
(
'album
name'
,
'description'
,
'label'
)
list_filter
=
(
'album
name'
)
list_display
=
(
'album
_name'
,
'description'
,
'release_date'
,
'label'
,
'song_count'
,
)
search_fields
=
(
'album
_name'
,
'description'
,
'label'
,
)
list_filter
=
(
'album
_name'
,
)
class
SongAdmin
(
admin
.
ModelAdmin
):
model
=
Song
list_display
=
(
'song
title'
,
'song length'
,
'lyrics'
,
'music video flag'
)
search_fields
=
(
'song
title'
,
'lyrics'
)
list_filter
=
(
'song
title'
)
list_display
=
(
'song
_title'
,
'song_length'
,
'lyrics'
,
'music_video'
,
)
search_fields
=
(
'song
_title'
,
'lyrics'
,
)
list_filter
=
(
'song
_title'
,
)
admin
.
site
.
register
(
Artist
)
admin
.
site
.
register
(
Album
)
admin
.
site
.
register
(
Song
)
\ No newline at end of file
admin
.
site
.
register
(
Artist
,
ArtistAdmin
)
admin
.
site
.
register
(
Album
,
AlbumAdmin
)
admin
.
site
.
register
(
Song
,
SongAdmin
)
\ No newline at end of file
mavlee_music/homepage/models.py
View file @
d98df4ab
...
...
@@ -3,10 +3,13 @@ from django.db import models
# Create your models here.
class
Artist
(
models
.
Model
):
artist_name
=
models
.
CharField
(
max_length
=
50
)
monthly_listeners
=
models
.
IntegerField
(
)
monthly_listeners
=
models
.
CharField
(
max_length
=
20
)
birth_name
=
models
.
CharField
(
max_length
=
50
)
bio
=
models
.
CharField
(
max_length
=
700
)
def
__str__
(
self
):
return
self
.
artist_name
class
Album
(
models
.
Model
):
album_name
=
models
.
CharField
(
max_length
=
50
)
artist_name
=
models
.
ForeignKey
(
Artist
,
on_delete
=
models
.
CASCADE
)
...
...
@@ -15,10 +18,16 @@ class Album(models.Model):
label
=
models
.
CharField
(
max_length
=
50
)
song_count
=
models
.
IntegerField
()
def
__str__
(
self
):
return
self
.
album_name
class
Song
(
models
.
Model
):
song_title
=
models
.
CharField
(
max_length
=
50
)
artist_name
=
models
.
ForeignKey
(
Artist
,
on_delete
=
models
.
CASCADE
)
album
=
models
.
ForeignKey
(
Album
,
on_delete
=
models
.
CASCADE
)
song_length
=
models
.
IntegerField
(
)
song_length
=
models
.
CharField
(
max_length
=
5
)
music_video
=
models
.
BooleanField
()
lyrics
=
models
.
TextField
()
def
__str__
(
self
):
return
self
.
song_title
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