updated the models to implement relationships

parent 6fb230c3
# Generated by Django 4.1.6 on 2023-02-13 12:57
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('About', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='album',
name='artist',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='About.artist'),
),
migrations.AlterField(
model_name='song',
name='album',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='About.album'),
),
migrations.AlterField(
model_name='song',
name='artist',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='About.artist'),
),
]
...@@ -6,12 +6,12 @@ class Artist(models.Model): ...@@ -6,12 +6,12 @@ class Artist(models.Model):
class Album(models.Model): class Album(models.Model):
album_name = models.TextField() album_name = models.TextField()
artist = models.TextField() artist = models.ForeignKey(Artist, on_delete=models.CASCADE)
description = models.TextField() description = models.TextField()
release_date = models.DateField() release_date = models.DateField()
class Song(models.Model): class Song(models.Model):
song_title = models.TextField() song_title = models.TextField()
artist = models.TextField() artist = models.ForeignKey(Artist, on_delete=models.CASCADE)
album = models.TextField() album = models.ForeignKey(Album, on_delete=models.CASCADE)
song_length = models.IntegerField() song_length = models.IntegerField()
\ No newline at end of file
No preview for this file type
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