Modify models and populated records using admin panel

parent 03b7d15e
No preview for this file type
# Generated by Django 3.2 on 2023-02-21 13:11
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('homepage', '0007_auto_20230221_2012'),
]
operations = [
migrations.AlterField(
model_name='album',
name='artist',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='homepage.artist'),
),
migrations.AlterField(
model_name='song',
name='album',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='homepage.album'),
),
migrations.AlterField(
model_name='song',
name='artist',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='homepage.artist'),
),
]
......@@ -7,19 +7,25 @@ class Artist(models.Model):
monthly_listeners = models.IntegerField()
birth_name = models.CharField(max_length=100)
bio = models.CharField(max_length=700)
def __str__(self):
return self.artist_name
class Album(models.Model):
album_name = models.CharField(max_length=100)
artist = models.CharField(max_length=100)
artist = models.ForeignKey(Artist, on_delete=models.CASCADE)
description = models.CharField(max_length=700)
release_date = models.IntegerField()
label = models.CharField(max_length=100)
song_count = models.IntegerField(default=0)
def __str__(self):
return self.album_name
class Song(models.Model):
song_title = models.CharField(max_length=100)
artist = models.CharField(max_length=100)
album = models.CharField(max_length=100)
artist = models.ForeignKey(Artist, on_delete=models.CASCADE)
album = models.ForeignKey(Album, on_delete=models.CASCADE)
song_length = models.IntegerField()
music_video = models.BooleanField()
lyrics = models.CharField(max_length=2000)
def __str__(self):
return 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