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): ...@@ -6,6 +6,9 @@ class Artist(models.Model):
birth_name = models.CharField(max_length = 50) birth_name = models.CharField(max_length = 50)
bio = models.CharField(max_length = 700) bio = models.CharField(max_length = 700)
def __str__(self):
return self.artist_name
class Album(models.Model): class Album(models.Model):
album_name = models.CharField(max_length = 100) album_name = models.CharField(max_length = 100)
artist = models.ForeignKey(Artist, on_delete = models.CASCADE) artist = models.ForeignKey(Artist, on_delete = models.CASCADE)
...@@ -14,10 +17,16 @@ class Album(models.Model): ...@@ -14,10 +17,16 @@ class Album(models.Model):
label = models.CharField(max_length = 100) label = models.CharField(max_length = 100)
song_count = models.IntegerField() song_count = models.IntegerField()
def __str__(self):
return self.album_name
class Song(models.Model): class Song(models.Model):
song_title = models.CharField(max_length = 100) song_title = models.CharField(max_length = 100)
artist = models.ForeignKey(Artist, on_delete = models.CASCADE) artist = models.ForeignKey(Artist, on_delete = models.CASCADE)
album = models.ForeignKey(Album, on_delete = models.CASCADE) album = models.ForeignKey(Album, on_delete = models.CASCADE)
song_length = models.IntegerField() song_length = models.IntegerField()
music_video = models.BooleanField() music_video = models.BooleanField()
lyrics = models.CharField(max_length = 1500) lyrics = models.CharField(max_length = 1500)
\ No newline at end of file
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