Commit cf25b499 authored by justin's avatar justin

Added string representations of models, migrations done

parent 521d9f85
# Generated by Django 4.1.6 on 2023-02-20 10:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('homepage', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='album',
name='label',
field=models.CharField(blank=True, max_length=250),
),
migrations.AddField(
model_name='album',
name='song_count',
field=models.IntegerField(null=True),
),
migrations.AddField(
model_name='artist',
name='bio',
field=models.CharField(default='No information available.', max_length=700),
),
migrations.AddField(
model_name='artist',
name='birth_name',
field=models.CharField(default=models.CharField(max_length=200), max_length=200),
),
migrations.AddField(
model_name='song',
name='lyrics',
field=models.TextField(default='Unknown lyrics.'),
),
migrations.AddField(
model_name='song',
name='music_video',
field=models.BooleanField(default=False),
),
]
...@@ -3,13 +3,16 @@ from django.db import models ...@@ -3,13 +3,16 @@ from django.db import models
class Artist(models.Model): class Artist(models.Model):
artist_name = models.CharField(max_length=200) artist_name = models.CharField(max_length=200)
birth_name = models.CharField(max_length=200) birth_name = models.CharField(max_length=200, default=artist_name)
bio = models.CharField( bio = models.CharField(
max_length=700, max_length=700,
default="No information available.", default="No information available.",
) )
monthly_listeners = models.IntegerField(default=0) monthly_listeners = models.IntegerField(default=0)
def __str__(self):
return self.artist_name
class Album(models.Model): class Album(models.Model):
album_name = models.CharField(max_length=250) album_name = models.CharField(max_length=250)
...@@ -22,8 +25,14 @@ class Album(models.Model): ...@@ -22,8 +25,14 @@ class Album(models.Model):
auto_now=False, auto_now=False,
auto_now_add=False, auto_now_add=False,
) )
label = models.CharField(max_length=250) label = models.CharField(
song_count = models.IntegerField() max_length=250,
blank=True,
)
song_count = models.IntegerField(null=True)
def __str__(self):
return "{} by {}".format(self.album_name, self.artist)
class Song(models.Model): class Song(models.Model):
...@@ -37,5 +46,8 @@ class Song(models.Model): ...@@ -37,5 +46,8 @@ class Song(models.Model):
on_delete=models.CASCADE, on_delete=models.CASCADE,
) )
song_length = models.PositiveIntegerField() song_length = models.PositiveIntegerField()
music_video = models.BooleanField() music_video = models.BooleanField(default=False)
lyrics = models.TextField(default="Unknown lyrics.") lyrics = models.TextField(default="Unknown lyrics.")
def __str__(self):
return "{} by {} from {}".format(self.song_title, self.artist, self.album)
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