Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
addysalto_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
Mary Adelaide A. Salto
addysalto_music
Commits
ee225008
Commit
ee225008
authored
Feb 21, 2023
by
Mary Adelaide A. Salto
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'lab02'
parents
458c4d35
d67fb8e8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
8 deletions
+48
-8
README.txt
README.txt
+5
-4
admin.py
addysalto_music/Homepage/admin.py
+25
-1
models.py
addysalto_music/Homepage/models.py
+18
-3
No files found.
README.txt
View file @
ee225008
Mary Adelaide A. Salto, 215208, CSCI 40-F;
Lab 01: Song Library;
February 13, 2023;
This is to certify that the lab was truthfully completed by me;
<sgd> Mary Adelaide A. Salto, February 13, 2023
Lab 02: Song Library v2;
February 21, 2023;
This is to certify that the lab was truthfully completed by me
and I have not used Python language code from any unauthorized source;
<sgd> Mary Adelaide A. Salto, February 21, 2023
addysalto_music/Homepage/admin.py
View file @
ee225008
from
django.contrib
import
admin
from
.models
import
Artist
,
Album
,
Song
# Register your models here.
class
ArtistAdmin
(
admin
.
ModelAdmin
):
model
=
Artist
search_fields
=
(
'artist_name'
,
'birth_name'
)
list_display
=
(
'artist_name'
,
'birth_name'
,
'monthly_listeners'
)
list_filter
=
[
'artist_name'
,
'birth_name'
]
class
AlbumAdmin
(
admin
.
ModelAdmin
):
model
=
Album
search_fields
=
(
'album_name'
,
'description'
,
'label'
)
list_display
=
(
'album_name'
,
'description'
,
'release_date'
,
'label'
,
'song_count'
)
list_filter
=
[
'album_name'
]
class
SongAdmin
(
admin
.
ModelAdmin
):
model
=
Song
search_fields
=
(
'song_title'
,
'lyrics'
)
list_display
=
(
'song_title'
,
'song_length'
,
'lyrics'
,
'music_video'
)
list_filter
=
[
'song_title'
]
admin
.
site
.
register
(
Artist
,
ArtistAdmin
)
admin
.
site
.
register
(
Album
,
AlbumAdmin
)
admin
.
site
.
register
(
Song
,
SongAdmin
)
\ No newline at end of file
addysalto_music/Homepage/models.py
View file @
ee225008
...
...
@@ -3,15 +3,30 @@ from django.db import models
class
Artist
(
models
.
Model
):
artist_name
=
models
.
CharField
(
max_length
=
50
)
monthly_listeners
=
models
.
IntegerField
()
birth_name
=
models
.
CharField
(
max_length
=
50
,
null
=
True
)
bio
=
models
.
TextField
(
max_length
=
700
,
null
=
True
)
def
__str__
(
self
):
return
self
.
artist_name
class
Album
(
models
.
Model
):
album_name
=
models
.
CharField
(
max_length
=
50
)
artist
=
models
.
ForeignKey
(
Artist
,
on_delete
=
models
.
CASCADE
)
description
=
models
.
CharField
(
max_length
=
200
)
description
=
models
.
TextField
(
max_length
=
10000
,
null
=
True
)
release_date
=
models
.
CharField
(
max_length
=
50
)
label
=
models
.
CharField
(
max_length
=
50
,
null
=
True
)
song_count
=
models
.
IntegerField
(
null
=
True
)
def
__str__
(
self
):
return
self
.
album_name
class
Song
(
models
.
Model
):
song_title
=
models
.
CharField
(
max_length
=
50
)
artist
=
models
.
ForeignKey
(
Artist
,
on_delete
=
models
.
CASCADE
)
album
=
models
.
CharField
(
max_length
=
50
)
song_length
=
models
.
IntegerField
()
\ No newline at end of file
album
=
models
.
ForeignKey
(
Album
,
on_delete
=
models
.
CASCADE
)
song_length
=
models
.
IntegerField
()
music_video
=
models
.
BooleanField
(
null
=
True
)
lyrics
=
models
.
TextField
(
max_length
=
5000
,
null
=
True
)
def
__str__
(
self
):
return
self
.
song_title
\ 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