chore: updated models.py of homepage to build the models for the data elements of the music library

parent 1c8ef12e
Pipeline #2770 failed with stages
# Generated by Django 4.1.6 on 2023-02-13 16:17
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()),
],
),
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()),
('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=200)),
('release_date', models.CharField(max_length=50)),
('artist', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='homepage.artist')),
],
),
]
from django.db import models
# Create your models here.
class Artist(models.Model):
artist_name = models.CharField(max_length=50)
monthly_listeners = models.IntegerField()
class Album(models.Model):
album_name = models.CharField(max_length=50)
artist = models.ForeignKey(Artist, on_delete=models.CASCADE)
description = models.CharField(max_length=200)
release_date = models.CharField(max_length=50)
class Song(models.Model):
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()
\ No newline at end of file
......@@ -17,8 +17,8 @@ from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path('admin/', admin.site.urls),
path('homepage/', include('homepage.urls', namespace="homepage")),
path('about/', include('about.urls', namespace="about")),
path('contact/', include('contact.urls', namespace="contact")),
path('admin/', admin.site.urls),
]
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