I just started with django and I want to make a spotify clone. I want to make it so then when you click on an album it shows the songs for that album.
this is my models.py
from django.db import models
class album(models.Model):
title = models.CharField(max_length=50)
artist = models.IntegerField()
genre = models.CharField(max_length=20)
id = models.AutoField(primary_key=True)
artwork = models.CharField(max_length=1000)
class artist(models.Model):
name = models.CharField(max_length=50)
id = models.AutoField(primary_key=True)
class song(models.Model):
name = models.CharField(max_length=60)
artist = models.IntegerField()
album = models.IntegerField()
id = models.AutoField(primary_key=True)
This is my views.py
from django.shortcuts import render
from .models import album, song
def home(request):
context = {
'albums': album.objects.all(),
}
return render(request, 'main/index.html', context)