Commit 840988dd authored by Brescia Amandy's avatar Brescia Amandy

built models for Artist, Album, and Song class

parent dd933405
Pipeline #2697 failed with stages
from django.urls import path from django.urls import path
from .views import index from .views import about
urlpatterns = [ urlpatterns = [
path('', index, name='index'), path('', about, name='about'),
] ]
# This might be needed depending on your Django version # This might be needed depending on your Django version
......
...@@ -3,5 +3,5 @@ from django.http import HttpResponse ...@@ -3,5 +3,5 @@ from django.http import HttpResponse
# Create your views here. # Create your views here.
def index(request): def about(request):
return HttpResponse('Hello World! This came from the index view') return HttpResponse('I like listening to OPM songs and Taylor Swift')
...@@ -40,6 +40,9 @@ INSTALLED_APPS = [ ...@@ -40,6 +40,9 @@ INSTALLED_APPS = [
'django.contrib.sessions', 'django.contrib.sessions',
'django.contrib.messages', 'django.contrib.messages',
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'about',
'homepage',
'contact',
] ]
MIDDLEWARE = [ MIDDLEWARE = [
......
from django.urls import path from django.urls import path
from .views import index from .views import contact
urlpatterns = [ urlpatterns = [
path('', index, name='index'), path('', contact, name='contact'),
] ]
# This might be needed depending on your Django version # This might be needed depending on your Django version
......
...@@ -3,5 +3,5 @@ from django.http import HttpResponse ...@@ -3,5 +3,5 @@ from django.http import HttpResponse
# Create your views here. # Create your views here.
def index(request): def contact(request):
return HttpResponse('Hello World! This came from the index view') return HttpResponse('Phone Number: +63 9175496303')
\ No newline at end of file \ No newline at end of file
# Generated by Django 3.0 on 2023-02-13 14:33
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.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('album_name', models.CharField(max_length=255)),
('description', models.TextField()),
('release_date', models.CharField(max_length=255)),
],
),
migrations.CreateModel(
name='Artist',
fields=[
('id', models.AutoField(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.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('song_title', models.CharField(max_length=255)),
('song_length', models.IntegerField()),
('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.CharField(max_length=255)
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.IntegerField()
\ No newline at end of file
from django.urls import path from django.urls import path
from .views import index from .views import homepage
urlpatterns = [ urlpatterns = [
path('', index, name='index'), path('', homepage, name='homepage'),
] ]
# This might be needed depending on your Django version # This might be needed depending on your Django version
......
...@@ -3,5 +3,5 @@ from django.http import HttpResponse ...@@ -3,5 +3,5 @@ from django.http import HttpResponse
# Create your views here. # Create your views here.
def index(request): def homepage(request):
return HttpResponse('Hello World! This came from the index view') return HttpResponse("Welcome to Brescia's Music Library")
\ No newline at end of file \ 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