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
675c06f1
Commit
675c06f1
authored
Feb 21, 2023
by
Layla Mikel Villanueva
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated models.py to fix some errors
Fixed the code for the models so it would run properly
parent
e87edc99
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
62 additions
and
12 deletions
+62
-12
db.sqlite3
layvillanueva_music/db.sqlite3
+0
-0
admin.py
layvillanueva_music/homepage/admin.py
+3
-3
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
+5
-9
No files found.
layvillanueva_music/db.sqlite3
View file @
675c06f1
No preview for this file type
layvillanueva_music/homepage/admin.py
View file @
675c06f1
...
...
@@ -10,12 +10,12 @@ class ArtistAdmin(admin.ModelAdmin):
list_display
=
(
'artist_name'
,
'birth_name'
,
'monthly_listeners'
)
list_filter
=
(
'artist_name'
,
)
list_filter
=
(
'artist_name'
,)
fieldsets
=
[
(
'Artist Information'
,
{
'fields'
:
[
(
'artist_name'
,
'birth_name'
),
'monthly
listeners'
,
'bio'
(
'artist_name'
,
'birth_name'
),
'monthly
_
listeners'
,
'bio'
]
})
]
...
...
@@ -27,7 +27,7 @@ class AlbumAdmin(admin.ModelAdmin):
list_display
=
(
'album_name'
,
'description'
,
'release_date'
,
'label'
,
'song_count'
)
list_filter
=
(
'album_name'
,
)
list_filter
=
(
'album_name'
,)
fieldsets
=
[
(
'Album Information'
,
{
...
...
layvillanueva_music/homepage/migrations/0005_alter_song_song_length.py
0 → 100644
View file @
675c06f1
# 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 @
675c06f1
# 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 @
675c06f1
# 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 @
675c06f1
...
...
@@ -9,8 +9,7 @@ class Artist(models.Model):
bio
=
models
.
CharField
(
max_length
=
700
,
blank
=
True
,
null
=
True
)
def
__str__
(
self
):
return
'{} - {} monthly listeners a.k.a {} is {}'
.
format
(
self
.
birth_name
,
self
.
monthly_listeners
,
self
.
birth_name
,
self
.
bio
)
return
'{}'
.
format
(
self
.
artist_name
)
def
get_absolute_url
(
self
):
return
reverse
(
'artist_detail'
,
args
=
[
str
(
self
.
artist_name
)])
...
...
@@ -19,32 +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 {} with {} songs released on {} under {} is {}'
.
format
(
self
.
album_name
,
self
.
artist
,
self
.
song_count
,
self
.
release_date
,
self
.
label
,
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
):
isMusicVideo
=
[(
False
,
'does not have'
),(
True
,
'has'
)]
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
(
verbose_name
=
"Song Length (in seconds)"
)
music_video
=
models
.
BooleanField
(
verbose_name
=
"Music Video?"
,
default
=
False
,
choices
=
isMusicVideo
)
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. It {} a music video. Lyrics can be found here: {}'
.
format
(
self
.
song_title
,
self
.
artist
,
self
.
album
,
self
.
song_length
,
self
.
music_video
,
self
.
lyrics
)
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