Moved models from about to homepage

parent ae8d14f4
# Generated by Django 4.1.6 on 2023-02-21 10:09
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('About', '0002_album_label_album_song_count_artist_bio_and_more'),
]
operations = [
migrations.RemoveField(
model_name='song',
name='artist',
),
migrations.DeleteModel(
name='Album',
),
migrations.DeleteModel(
name='Artist',
),
migrations.DeleteModel(
name='Song',
),
]
from django.db import models from django.db import models
class Artist(models.Model):
default_string = "hi"
artist_name = models.CharField(max_length=50)
monthly_listeners = models.IntegerField()
birth_name = models.CharField(max_length=50, default=default_string)
bio = models.CharField(max_length=700, 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)])
class Album(models.Model):
default_string = "hi"
album_name = models.CharField(max_length=50)
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)
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)])
class Song(models.Model):
default_string = "hi"
song_title = models.CharField(max_length=50)
artist = models.ForeignKey(Artist, on_delete = models.CASCADE)
album = models.CharField(max_length=50)
song_length = models.IntegerField()
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)])
\ No newline at end of file
# Generated by Django 4.1.6 on 2023-02-21 10:09
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Artist',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('artist_name', models.CharField(max_length=50)),
('monthly_listeners', models.IntegerField()),
('birth_name', models.CharField(default='hi', max_length=50)),
('bio', models.CharField(default='hi', max_length=700)),
],
),
migrations.CreateModel(
name='Song',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('song_title', models.CharField(max_length=50)),
('album', models.CharField(max_length=50)),
('song_length', models.IntegerField()),
('music_video', models.BooleanField(default=True)),
('lyrics', models.CharField(default='hi', max_length=1000)),
('artist', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='Homepage.artist')),
],
),
migrations.CreateModel(
name='Album',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('album_name', models.CharField(max_length=50)),
('description', models.CharField(max_length=100)),
('release_date', models.CharField(max_length=50)),
('label', models.CharField(default='hi', max_length=1000)),
('song_count', models.IntegerField(default=0)),
('artist', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='Homepage.artist')),
],
),
]
from django.db import models from django.db import models
# Create your models here. class Artist(models.Model):
default_string = "hi"
artist_name = models.CharField(max_length=50)
monthly_listeners = models.IntegerField()
birth_name = models.CharField(max_length=50, default=default_string)
bio = models.CharField(max_length=700, 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)])
class Album(models.Model):
default_string = "hi"
album_name = models.CharField(max_length=50)
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)
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)])
class Song(models.Model):
default_string = "hi"
song_title = models.CharField(max_length=50)
artist = models.ForeignKey(Artist, on_delete = models.CASCADE)
album = models.CharField(max_length=50)
song_length = models.IntegerField()
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)])
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