Commit 762879f5 authored by Gabriel G. Garrero's avatar Gabriel G. Garrero

Added a way to see the artist, album, and song names when accessing the...

Added a way to see the artist, album, and song names when accessing the database. Populated the models with 10 records each.
parent aa5cda68
......@@ -6,6 +6,9 @@ class Artist(models.Model):
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 = 100)
artist = models.ForeignKey(Artist, on_delete = models.CASCADE)
......@@ -14,6 +17,9 @@ class Album(models.Model):
label = models.CharField(max_length = 100)
song_count = models.IntegerField()
def __str__(self):
return self.album_name
class Song(models.Model):
song_title = models.CharField(max_length = 100)
artist = models.ForeignKey(Artist, on_delete = models.CASCADE)
......@@ -21,3 +27,6 @@ class Song(models.Model):
song_length = models.IntegerField()
music_video = models.BooleanField()
lyrics = models.CharField(max_length = 1500)
def __str__(self):
return self.song_title
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment