Commit 90f674f6 authored by John Riz Daniel Ramos's avatar John Riz Daniel Ramos

Updated models.py of homepage

Changelogs for Artist model:
+ birth_name
+ bio
- func: __str__

Changelogs for Album model:
+ param: label
+ param: soung_count
- func: __str__

Changelogs for Song model:
+ param: music_video
+ param: lyrics
- func: __str__
parent 5f7d8dff
# Generated by Django 4.1.7 on 2023-02-21 10:41
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('homepage', '0002_auto_20230216_1611'),
]
operations = [
migrations.AddField(
model_name='album',
name='label',
field=models.CharField(blank=True, max_length=50),
),
migrations.AddField(
model_name='album',
name='song_count',
field=models.IntegerField(default='1'),
),
migrations.AddField(
model_name='artist',
name='bio',
field=models.CharField(blank=True, max_length=700),
),
migrations.AddField(
model_name='artist',
name='birth_name',
field=models.CharField(blank=True, max_length=50),
),
migrations.AddField(
model_name='song',
name='lyrics',
field=models.TextField(blank=True),
),
migrations.AddField(
model_name='song',
name='music_video',
field=models.BooleanField(default=False),
),
migrations.AlterField(
model_name='album',
name='artist',
field=models.CharField(max_length=50),
),
migrations.AlterField(
model_name='song',
name='artist',
field=models.CharField(max_length=50),
),
]
from django.db import models from django.db import models
# Create your models here.
class Artist(models.Model): class Artist(models.Model):
artist_name = models.CharField(max_length=50, unique=True) artist_name = models.CharField(max_length=50, unique=True)
monthly_listeners = models.IntegerField() monthly_listeners = models.IntegerField()
birth_name = models.CharField(max_length=50, blank=True)
bio = models.CharField(max_length=700, blank=True)
def __str__(self):
return '{}: {} monthly listeners'.format(self.artist_name, self.monthly_listeners)
class Album(models.Model): class Album(models.Model):
album_name = models.CharField(max_length=50) album_name = models.CharField(max_length=50)
artist = models.CharField(max_length=50, unique=True) artist = models.CharField(max_length=50)
description = models.CharField(max_length=150, unique=True) description = models.CharField(max_length=150, unique=True)
release_date = models.CharField(max_length=50) release_date = models.CharField(max_length=50)
label = models.CharField(max_length=50, blank=True)
song_count = models.IntegerField(default='1')
def __str__(self):
return '{} by {} | {} Released on {}'.format(self.album_name, self.artist, self.description, self.release_date)
class Song(models.Model): class Song(models.Model):
song_title = models.CharField(max_length=50) song_title = models.CharField(max_length=50)
artist = models.CharField(max_length=50, unique=True) artist = models.CharField(max_length=50)
album = models.CharField(max_length=150) album = models.CharField(max_length=150)
song_length = models.IntegerField() song_length = models.IntegerField()
music_video = models.BooleanField(default=False)
def __str__(self): lyrics = models.TextField(blank=True)
return '{} | {} | {} | {} secs.'.format(self.song_title, self.artist, self.album, self.song_length) \ No newline at end of file
\ No newline at end of file
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