Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
layvillanueva_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
Layla Mikel Villanueva
layvillanueva_music
Commits
d53edff8
Commit
d53edff8
authored
Feb 21, 2023
by
Layla Mikel Villanueva
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'lab02'
parents
b01912a4
e1ca2144
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
195 additions
and
11 deletions
+195
-11
README.txt
README.txt
+4
-4
urls.py
layvillanueva_music/contact/urls.py
+2
-0
admin.py
layvillanueva_music/homepage/admin.py
+60
-0
0003_album_label_album_song_count_artist_bio_and_more.py
.../0003_album_label_album_song_count_artist_bio_and_more.py
+43
-0
0004_alter_song_lyrics.py
...nueva_music/homepage/migrations/0004_alter_song_lyrics.py
+18
-0
0005_alter_song_song_length.py
..._music/homepage/migrations/0005_alter_song_song_length.py
+18
-0
0006_alter_album_description.py
...music/homepage/migrations/0006_alter_album_description.py
+18
-0
0007_alter_song_music_video.py
..._music/homepage/migrations/0007_alter_song_music_video.py
+18
-0
models.py
layvillanueva_music/homepage/models.py
+14
-7
No files found.
README.txt
View file @
d53edff8
* Layla Mikel Villanueva, 216288, BS CS-DGDD, CSCI 40-F
* Lab 0
1: Song Library
*
13
/02/2023
* Lab 0
2: Song Library v2
*
21
/02/2023
* I have honestly followed and completed the instructions
of the entire lab 01 all by myself.
* <sgd> Layla Mikel Villanueva, 13/02/2023
\ No newline at end of file
of the entire lab 02 all by myself.
* <sgd> Layla Mikel Villanueva, 21/02/2023
\ No newline at end of file
layvillanueva_music/contact/urls.py
View file @
d53edff8
from
django.urls
import
path
from
.views
import
index
urlpatterns
=
[
path
(
''
,
index
,
name
=
'index'
),
]
...
...
layvillanueva_music/homepage/admin.py
View file @
d53edff8
from
django.contrib
import
admin
from
.models
import
Artist
,
Album
,
Song
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'
)
fieldsets
=
[
(
'Artist Information'
,
{
'fields'
:
[
(
'artist_name'
,
'birth_name'
),
'monthly_ listeners'
,
'bio'
]
})
]
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'
,)
fieldsets
=
[
(
'Album Information'
,
{
'fields'
:
[
(
'album_name'
,
'artist'
),
(
'release_date'
,
'song_count'
),
'label'
,
'description'
]
})
]
class
SongAdmin
(
admin
.
ModelAdmin
):
model
=
Song
search_fields
=
(
'song_title'
,
'lyrics'
)
list_display
=
(
'song_title'
,
'song_length'
,
'lyrics'
,
'music_video'
)
list_filter
=
(
'song_title'
,)
fieldsets
=
[
(
'Song Information'
,
{
'fields'
:
[
(
'album'
,
'song_title'
),
'artist'
,
'song_length'
,
'music_video'
,
'lyrics'
]
})
]
# Register your models here.
admin
.
site
.
register
(
Artist
,
ArtistAdmin
)
admin
.
site
.
register
(
Album
,
AlbumAdmin
)
admin
.
site
.
register
(
Song
,
SongAdmin
)
layvillanueva_music/homepage/migrations/0003_album_label_album_song_count_artist_bio_and_more.py
0 → 100644
View file @
d53edff8
# Generated by Django 4.1.6 on 2023-02-21 10:20
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'homepage'
,
'0002_alter_artist_monthly_listeners'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'album'
,
name
=
'label'
,
field
=
models
.
CharField
(
blank
=
True
,
max_length
=
255
,
null
=
True
),
),
migrations
.
AddField
(
model_name
=
'album'
,
name
=
'song_count'
,
field
=
models
.
IntegerField
(
default
=
1
),
),
migrations
.
AddField
(
model_name
=
'artist'
,
name
=
'bio'
,
field
=
models
.
CharField
(
blank
=
True
,
max_length
=
700
,
null
=
True
),
),
migrations
.
AddField
(
model_name
=
'artist'
,
name
=
'birth_name'
,
field
=
models
.
CharField
(
blank
=
True
,
max_length
=
255
,
null
=
True
),
),
migrations
.
AddField
(
model_name
=
'song'
,
name
=
'lyrics'
,
field
=
models
.
CharField
(
blank
=
True
,
max_length
=
30000
,
null
=
True
),
),
migrations
.
AddField
(
model_name
=
'song'
,
name
=
'music_video'
,
field
=
models
.
BooleanField
(
choices
=
[(
False
,
'does not have'
),
(
True
,
'has'
)],
default
=
False
,
verbose_name
=
'Music Video?'
),
),
]
layvillanueva_music/homepage/migrations/0004_alter_song_lyrics.py
0 → 100644
View file @
d53edff8
# Generated by Django 4.1.6 on 2023-02-21 10:45
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'homepage'
,
'0003_album_label_album_song_count_artist_bio_and_more'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'song'
,
name
=
'lyrics'
,
field
=
models
.
TextField
(
blank
=
True
,
null
=
True
),
),
]
layvillanueva_music/homepage/migrations/0005_alter_song_song_length.py
0 → 100644
View file @
d53edff8
# Generated by Django 4.1.6 on 2023-02-21 11:19
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'homepage'
,
'0004_alter_song_lyrics'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'song'
,
name
=
'song_length'
,
field
=
models
.
DurationField
(
verbose_name
=
'Song Length (in seconds)'
),
),
]
layvillanueva_music/homepage/migrations/0006_alter_album_description.py
0 → 100644
View file @
d53edff8
# Generated by Django 4.1.6 on 2023-02-21 11:21
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'homepage'
,
'0005_alter_song_song_length'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'album'
,
name
=
'description'
,
field
=
models
.
TextField
(),
),
]
layvillanueva_music/homepage/migrations/0007_alter_song_music_video.py
0 → 100644
View file @
d53edff8
# Generated by Django 4.1.6 on 2023-02-21 11:26
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'homepage'
,
'0006_alter_album_description'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'song'
,
name
=
'music_video'
,
field
=
models
.
BooleanField
(
default
=
False
,
verbose_name
=
'Music Video?'
),
),
]
layvillanueva_music/homepage/models.py
View file @
d53edff8
from
django.db
import
models
# Create your models here.
class
Artist
(
models
.
Model
):
artist_name
=
models
.
CharField
(
max_length
=
255
,
unique
=
True
)
monthly_listeners
=
models
.
IntegerField
()
birth_name
=
models
.
CharField
(
max_length
=
255
,
blank
=
True
,
null
=
True
)
bio
=
models
.
CharField
(
max_length
=
700
,
blank
=
True
,
null
=
True
)
def
__str__
(
self
):
return
'{}
- {} monthly listeners'
.
format
(
self
.
artist_name
,
self
.
monthly_listeners
)
return
'{}
'
.
format
(
self
.
artist_name
)
def
get_absolute_url
(
self
):
return
reverse
(
'artist_detail'
,
args
=
[
str
(
self
.
artist_name
)])
...
...
@@ -15,25 +18,29 @@ class Artist(models.Model):
class
Album
(
models
.
Model
):
album_name
=
models
.
CharField
(
max_length
=
255
)
artist
=
models
.
ForeignKey
(
Artist
,
on_delete
=
models
.
CASCADE
)
description
=
models
.
CharField
(
max_length
=
999
)
description
=
models
.
TextField
(
)
release_date
=
models
.
DateField
()
label
=
models
.
CharField
(
max_length
=
255
,
blank
=
True
,
null
=
True
)
song_count
=
models
.
IntegerField
(
default
=
1
)
def
__str__
(
self
):
return
'{} by {} released on {} is {}'
.
format
(
self
.
album_name
,
self
.
artist
,
self
.
release_date
,
self
.
description
)
return
'{}'
.
format
(
self
.
album_name
)
def
get_absolute_url
(
self
):
return
reverse
(
'album_detail'
,
args
=
[
str
(
self
.
album_name
)])
class
Song
(
models
.
Model
):
song_title
=
models
.
CharField
(
max_length
=
255
)
artist
=
models
.
ForeignKey
(
Artist
,
on_delete
=
models
.
CASCADE
)
album
=
models
.
ForeignKey
(
Album
,
on_delete
=
models
.
CASCADE
)
song_length
=
models
.
DurationField
()
song_length
=
models
.
DurationField
()
music_video
=
models
.
BooleanField
(
verbose_name
=
"Music Video?"
,
default
=
False
)
lyrics
=
models
.
TextField
(
blank
=
True
,
null
=
True
)
def
__str__
(
self
):
return
'{} by {} from {} is {} long.'
.
format
(
self
.
song_title
,
self
.
artist
,
self
.
album
,
self
.
song_length
)
return
'{}'
.
format
(
self
.
song_title
)
def
get_absolute_url
(
self
):
return
reverse
(
'song_detail'
,
args
=
[
str
(
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