Commit 8d7d4737 authored by Brescia Amandy's avatar Brescia Amandy

Set labels for each model in in homepage/models.py

parent 7bea1470
...@@ -8,6 +8,9 @@ class Artist(models.Model): ...@@ -8,6 +8,9 @@ class Artist(models.Model):
birth_name = models.CharField(blank=True, max_length=255) birth_name = models.CharField(blank=True, max_length=255)
bio = models.TextField(blank=True, max_length=700) bio = models.TextField(blank=True, max_length=700)
def __str__(self):
return self.artist_name
class Album(models.Model): class Album(models.Model):
album_name = models.CharField(blank=True, max_length=255) album_name = models.CharField(blank=True, max_length=255)
artist = models.ForeignKey(Artist, on_delete=models.CASCADE) artist = models.ForeignKey(Artist, on_delete=models.CASCADE)
...@@ -16,6 +19,8 @@ class Album(models.Model): ...@@ -16,6 +19,8 @@ class Album(models.Model):
label = models.CharField(blank=True, max_length=255) label = models.CharField(blank=True, max_length=255)
song_count = models.PositiveSmallIntegerField(default=1) song_count = models.PositiveSmallIntegerField(default=1)
def __str__(self):
return self.album_name
class Song(models.Model): class Song(models.Model):
song_title = models.CharField(blank=True, max_length=255) song_title = models.CharField(blank=True, max_length=255)
...@@ -23,4 +28,7 @@ class Song(models.Model): ...@@ -23,4 +28,7 @@ class Song(models.Model):
album = models.ForeignKey(Album, on_delete=models.CASCADE) album = models.ForeignKey(Album, on_delete=models.CASCADE)
song_length = models.IntegerField(blank=True) song_length = models.IntegerField(blank=True)
music_video = models.BooleanField(default=False) music_video = models.BooleanField(default=False)
lyrics = models.TextField(blank=True) lyrics = models.TextField(blank=True)
\ No newline at end of file
def __str__(self):
return self.song_title
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