Commit db6b5602 authored by Tanya's avatar Tanya

Updated models.py with additional attributes

parent 401aff20
No preview for this file type
from django.db import models from django.db import models
class Artist(models.Model):
artist_name = models.TextField()
monthly_listeners = models.IntegerField()
class Album(models.Model):
album_name = models.TextField()
artist = models.TextField()
description = models.TextField()
release_date = models.DateField()
class Song(models.Model):
song_title = models.TextField()
artist = models.TextField()
album = models.TextField()
song_length = models.IntegerField()
from django.db import models from django.db import models
# Create your models here. class Artist(models.Model):
artist_name = models.TextField(default="")
monthly_listeners = models.IntegerField(default=0)
birth_name = models.TextField(default="")
bio = models.TextField(max_length=700, default="")
def __str__(self):
return '{}'.format(self.artist_name)
class Album(models.Model):
album_name = models.TextField(default="")
artist = models.ForeignKey(Artist, on_delete=models.CASCADE)
description = models.TextField(default="")
release_date = models.DateField()
label = models.TextField(default="")
song_count = models.IntegerField(default=0)
def __str__(self):
return '{}'.format(self.album_name)
class Song(models.Model):
song_title = models.TextField(default="")
artist = models.ForeignKey(Artist, on_delete=models.CASCADE)
album = models.ForeignKey(Album, on_delete=models.CASCADE)
song_length = models.IntegerField(default=0)
music_video = models.BooleanField(default=False)
lyrics = models.TextField(default="")
def __str__(self):
return '{}'.format(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