Commit 6a559e4f authored by Mariam Garsin's avatar Mariam Garsin

Created the homepage, about, and contact apps

parent b91d3a9e
from django.urls import path
from .views import index
urlpatterns = [
path('', index, name='index'),
]
app_name = "about"
\ No newline at end of file
from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
def index(request):
return HttpResponse('I tend to gravitate towards pop music because I like the beat of the musics.')
\ No newline at end of file
from django.urls import path
from .views import index
urlpatterns = [
path('', index, name='index'),
]
app_name = "contact"
\ No newline at end of file
from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
def index(request):
return HttpResponse('Contact Information: 09669746546')
\ No newline at end of file
# Generated by Django 4.2 on 2023-04-14 08:30
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.TextField()),
('description', models.TextField()),
('release_date', models.IntegerField()),
],
),
migrations.CreateModel(
name='Artist',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('artist_name', models.TextField()),
('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.TextField()),
('song_length', models.FloatField()),
('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
# Create your models here.
class Artist(models.Model):
artist_name = models.TextField()
monthly_listeners = models.IntegerField()
def __str__(self):
return '{}, {}'.format(self.artist_name, self.monthly_listeners)
class Album(models.Model):
album_name = models.TextField()
artist = models.ForeignKey(Artist, on_delete=models.CASCADE)
description = models.TextField()
release_date = models.IntegerField()
def __str__(self):
return '{}, {} {} {}'.format(self.album_name, self.artist, self.description, self.release_date)
class Song(models.Model):
song_title = models.TextField()
artist = models.ForeignKey(Artist, on_delete=models.CASCADE)
album = models.ForeignKey(Album, on_delete=models.CASCADE)
song_length = models.FloatField()
def __str__(self):
return '{}, {} {} {}'.format(self.song_title, self.artist, self.album, self.album)
from django.urls import path
from .views import index
urlpatterns = [
path('', index, name='index'),
]
app_name = "homepage"
\ No newline at end of file
from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
def index(request):
return HttpResponse('Welcome to Yam’s Music Library!')
\ No newline at end of file
......@@ -41,9 +41,9 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'homepage',
'about',
'contact',
'homepage',
]
MIDDLEWARE = [
......
......@@ -15,8 +15,11 @@ Including another URLconf
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from django.urls import include, path
urlpatterns = [
path('about/', include('about.urls', namespace="about")),
path('contact/', include('contact.urls', namespace="contact")),
path('homepage/', include('homepage.urls', namespace="homepage")),
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