Commit 9f21c18a authored by EJ Mejilla's avatar EJ Mejilla

Updated homepage/models.py

parent be8d2e7f
......@@ -6,6 +6,8 @@ from django.urls import reverse
class Artist(models.Model):
artist_name = models.CharField(max_length=100, unique=True)
monthly_listeners = models.IntegerField()
birth_name = models.CharField(max_length=100, unique=True)
bio = models.CharField(max_length=700)
def __str__(self):
return self.artist_name
......@@ -19,6 +21,8 @@ class Album(models.Model):
artist = models.ForeignKey(Artist, on_delete=models.CASCADE)
description = models.CharField(max_length=500)
release_date = models.DateField()
label = models.CharField(max_length=100, unique=True)
song_count = models.IntegerField()
def __str__(self):
return f"{self.artist}'s {self.album_name}"
......@@ -26,11 +30,14 @@ class Album(models.Model):
def get_absolute_url(self):
return reverse('album_detail', args=[str(self.album_name)])
class Song(models.Model):
song_title = models.CharField(max_length=100, unique=True)
artist = models.ForeignKey(Artist, on_delete=models.CASCADE)
album = models.ForeignKey(Album, on_delete=models.CASCADE)
song_length = models.IntegerField()
music_video = models.BooleanField()
lyrics = models.CharField()
def __str__(self):
return f"{self.artist} - {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