Commit 32cb52f1 authored by Ciella's avatar Ciella

milestone: added required information in homepage and models needed for the song library

parent 9739a49f
Pipeline #2688 failed with stages
...@@ -43,6 +43,7 @@ INSTALLED_APPS = [ ...@@ -43,6 +43,7 @@ INSTALLED_APPS = [
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'about', 'about',
'contact', 'contact',
'homepage',
] ]
MIDDLEWARE = [ MIDDLEWARE = [
......
...@@ -17,6 +17,7 @@ from django.contrib import admin ...@@ -17,6 +17,7 @@ from django.contrib import admin
from django.urls import include, path from django.urls import include, path
urlpatterns = [ urlpatterns = [
path('homepage/', include('homepage.urls', namespace='homepage')),
path('about/', include('about.urls', namespace='about')), path('about/', include('about.urls', namespace='about')),
path('contact/', include('contact.urls', namespace='contact')), path('contact/', include('contact.urls', namespace='contact')),
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
......
# Generated by Django 4.1.6 on 2023-02-13 14:14
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
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=255)),
('description', models.TextField()),
('release_date', models.DateField()),
],
),
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=255)),
('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=255)),
('song_length', models.DurationField()),
('album', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='homepage.album')),
('artist', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='homepage.artist')),
],
),
migrations.AddField(
model_name='album',
name='artist',
field=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. # Create your models here.
class Artist(models.Model):
artist_name = models.CharField(max_length=255)
monthly_listeners = models.IntegerField()
class Album(models.Model):
album_name = models.CharField(max_length=255)
artist = models.ForeignKey(Artist, on_delete=models.CASCADE)
description = models.TextField()
release_date = models.DateField()
class Song(models.Model):
song_title = models.CharField(max_length=255)
artist = models.ForeignKey(Artist, on_delete=models.CASCADE)
album = models.ForeignKey(Album, on_delete=models.CASCADE)
song_length = models.DurationField()
\ No newline at end of file
from django.urls import path
from .views import index
urlpatterns = [
path('', index, name='index'),
]
app_name = 'homepage'
from django.shortcuts import render from django.shortcuts import render
from django.http import HttpResponse
# Create your views here. # Create your views here.
def index(request):
return HttpResponse('Welcome to Ciella\'s Music Library!')
\ 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