Commit 64d7d5b5 authored by Jose Gabriel L. Salas's avatar Jose Gabriel L. Salas

removed unneccessary code and added __str__ def

parent 20299b4e
...@@ -5,7 +5,10 @@ class Artist(models.Model): ...@@ -5,7 +5,10 @@ class Artist(models.Model):
artist_name = models.CharField(max_length=50) artist_name = models.CharField(max_length=50)
monthly_listeners = models.IntegerField() monthly_listeners = models.IntegerField()
birth_name = models.CharField(max_length=50, blank=True) birth_name = models.CharField(max_length=50, blank=True)
bio = models.CharField(max_length=700, blank=True) bio = models.CharField(max_length=7000, blank=True)
def __str__(self):
return '{}: {}'.format(self.artist_name, self.birth_name)
class Album(models.Model): class Album(models.Model):
...@@ -17,12 +20,19 @@ class Album(models.Model): ...@@ -17,12 +20,19 @@ class Album(models.Model):
label = models.CharField(max_length=50, blank=True) label = models.CharField(max_length=50, blank=True)
song_count = models.IntegerField(default='0') song_count = models.IntegerField(default='0')
def __str__(self):
return '{}: {}'.format(self.album_name, self.artist.artist_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,
related_name='song') related_name='song')
album = models.ForeignKey(Album, on_delete=models.CASCADE) album = models.ForeignKey(Album, on_delete=models.CASCADE)
song_length = models.IntegerField() song_length = models.FloatField()
music_video = models.BooleanField(default=None) music_video = models.BooleanField(default=None)
lyrics = models.CharField(max_length=6500, blank=True) lyrics = models.CharField(max_length=10000, blank=True)
def __str__(self):
return '{}: {}'.format(self.song_title, self.artist.artist_name)
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