Fixed and cleaned models

parent cd05fd1e
# Generated by Django 4.1.6 on 2023-02-21 12:15
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('Homepage', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='album',
name='album_name',
field=models.CharField(default='', max_length=50),
),
migrations.AlterField(
model_name='album',
name='description',
field=models.CharField(default='', max_length=100),
),
migrations.AlterField(
model_name='album',
name='label',
field=models.CharField(default='', max_length=50),
),
migrations.AlterField(
model_name='album',
name='release_date',
field=models.CharField(default='', max_length=50),
),
migrations.AlterField(
model_name='artist',
name='artist_name',
field=models.CharField(default='', max_length=50),
),
migrations.AlterField(
model_name='artist',
name='bio',
field=models.TextField(default='', max_length=1000),
),
migrations.AlterField(
model_name='artist',
name='birth_name',
field=models.CharField(default='', max_length=50),
),
migrations.AlterField(
model_name='artist',
name='monthly_listeners',
field=models.IntegerField(default=0),
),
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='lyrics',
field=models.TextField(default='', max_length=1000),
),
migrations.AlterField(
model_name='song',
name='song_length',
field=models.IntegerField(default=0),
),
migrations.AlterField(
model_name='song',
name='song_title',
field=models.CharField(default='', max_length=50),
),
]
from django.db import models
class Artist(models.Model):
default_string = "hi"
artist_name = models.CharField(max_length=50)
monthly_listeners = models.IntegerField()
default_string = ""
artist_name = models.CharField(max_length=50, default=default_string)
monthly_listeners = models.IntegerField(default = 0)
birth_name = models.CharField(max_length=50, default=default_string)
bio = models.CharField(max_length=700, default=default_string)
bio = models.TextField(max_length=1000, default=default_string)
def __str__(self):
return '{}: {} monthly listeners'.format(self.artist_name, self.monthly_listeners)
def get_absolute_url(self):
return reverse('artist name', args=[str(self.artist_name)])
return '{}'.format(self.artist_name)
class Album(models.Model):
default_string = "hi"
album_name = models.CharField(max_length=50)
default_string = ""
album_name = models.CharField(max_length=50, default=default_string)
artist = models.ForeignKey(Artist, on_delete = models.CASCADE)
description = models.CharField(max_length=100)
release_date = models.CharField(max_length=50)
label = models.CharField(max_length=1000, default=default_string)
description = models.CharField(max_length=100, default=default_string)
release_date = models.CharField(max_length=50, default=default_string)
label = models.CharField(max_length=50, default=default_string)
song_count = models.IntegerField(default = 0)
def __str__(self):
return '{} by {}. {}. Released On: {}'.format(self.album_name, self.artist, self.description, self.release_date)
def get_absolute_url(self):
return reverse('album name', args=[str(self.album_name)])
return '{}'.format(self.album_name)
class Song(models.Model):
default_string = "hi"
song_title = models.CharField(max_length=50)
default_string = ""
song_title = models.CharField(max_length=50, default=default_string)
artist = models.ForeignKey(Artist, on_delete = models.CASCADE)
album = models.CharField(max_length=50)
song_length = models.IntegerField()
album = models.ForeignKey(Album, on_delete = models.CASCADE)
song_length = models.IntegerField(default = 0)
music_video = models.BooleanField(default=True)
lyrics = models.CharField(max_length=1000, default=default_string)
def __str__(self):
return '{} produced by {}, from the album {}. {} is the duration'.format(self.song_title, self.monthly_artist, self.album, self.song_length)
def get_absolute_url(self):
return reverse('song title', args=[str(self.song_title)])
lyrics = models.TextField(max_length=1000, default=default_string)
\ 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