Commit 3279d3bf authored by Ian Rafael T. Aragoza's avatar Ian Rafael T. Aragoza

Updated and migrated models.

parent 6a0b3d47
# Generated by Django 4.1.6 on 2023-02-20 11:33
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('homepage', '0003_alter_artist_monthly_listeners'),
]
operations = [
migrations.AddField(
model_name='album',
name='label',
field=models.CharField(blank=True, max_length=100),
),
migrations.AddField(
model_name='album',
name='song_count',
field=models.IntegerField(blank=True, null=True),
),
migrations.AddField(
model_name='artist',
name='bio',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='artist',
name='birth_name',
field=models.CharField(blank=True, max_length=100, null=True),
),
migrations.AddField(
model_name='song',
name='lyrics',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='song',
name='music_video',
field=models.BooleanField(default=False),
),
]
......@@ -7,9 +7,9 @@ from django.urls import reverse
class Artist(models.Model):
artist_name = models.CharField(max_length=100, unique=True)
birth_name = models.CharField(max_length=100)
birth_name = models.CharField(max_length=100,blank=True, null=True)
monthly_listeners = models.IntegerField()
bio = models.CharField(max_length=700)
bio = models.TextField(blank=True, null=True)
def __str__(self):
return '{}'.format(self.artist_name, self.monthly_listeners)
......@@ -22,8 +22,8 @@ class Album(models.Model):
artist = models.ForeignKey(Artist, on_delete=models.CASCADE, related_name='albums')
description = models.CharField(max_length=255)
release_date = models.DateField()
label = models.CharField(max_length=100)
song_count = models.IntegerField()
song_count = models.IntegerField(blank=True, null=True)
label = models.CharField(max_length=100, blank=True)
def __str__(self):
return '{} by {}'.format(self.album_name, self.artist)
......@@ -36,11 +36,11 @@ class Song(models.Model):
artist = models.ForeignKey(Artist, on_delete=models.CASCADE, related_name='songs')
album = models.ForeignKey(Album, on_delete=models.CASCADE, related_name='songs')
song_length = models.DurationField()
music_video = models.BooleanField()
lyrics = models.CharField()
music_video = models.BooleanField(default=False)
lyrics = models.TextField(blank=True, null=True)
def __str__(self):
return '{} - {} ({})'.format(self.artist, self.song_title, self.song_length)
return '{} - {}'.format(self.artist, self.song_title)
def get_absolute_url(self):
return reverse('song_detail', args=[str(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