Updated the models with new attributes

parent e5678313
# Generated by Django 4.1.6 on 2023-02-21 10:08
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('About', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='album',
name='label',
field=models.CharField(default='hi', max_length=1000),
),
migrations.AddField(
model_name='album',
name='song_count',
field=models.IntegerField(default=0),
),
migrations.AddField(
model_name='artist',
name='bio',
field=models.CharField(default='hi', max_length=700),
),
migrations.AddField(
model_name='artist',
name='birth_name',
field=models.CharField(default='hi', max_length=50),
),
migrations.AddField(
model_name='song',
name='lyrics',
field=models.CharField(default='hi', max_length=1000),
),
migrations.AddField(
model_name='song',
name='music_video',
field=models.BooleanField(default=True),
),
]
from django.db import models
class Artist(models.Model):
default_string = "hi"
artist_name = models.CharField(max_length=50)
monthly_listeners = models.IntegerField()
birth_name = models.CharField(max_length=50, default=default_string)
bio = models.CharField(max_length=700, default=default_string)
def __str__(self):
return '{}: {} monthly listeners'.format(self.artist_name, self.monthly_listeners)
......@@ -11,10 +14,13 @@ class Artist(models.Model):
return reverse('artist name', args=[str(self.artist_name)])
class Album(models.Model):
default_string = "hi"
album_name = models.CharField(max_length=50)
artist = models.ForeignKey(Artist, on_delete = models.CASCADE)
description = models.CharField(max_length=100)
release_date = models.CharField(max_length=50)
label = models.CharField(max_length=1000, default=default_string)
song_count = models.IntegerField(default = 0)
def __str__(self):
return '{} by {}. {}. Released On: {}'.format(self.album_name, self.artist, self.description, self.release_date)
......@@ -23,10 +29,13 @@ class Album(models.Model):
return reverse('album name', args=[str(self.album_name)])
class Song(models.Model):
default_string = "hi"
song_title = models.CharField(max_length=50)
artist = models.ForeignKey(Artist, on_delete = models.CASCADE)
album = models.CharField(max_length=50)
song_length = models.IntegerField()
music_video = models.BooleanField(default=True)
lyrics = models.CharField(max_length=1000, default=default_string)
def __str__(self):
return '{} produced by {}, from the album {}. {} is the duration'.format(self.song_title, self.monthly_artist, self.album, self.song_length)
......
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