Skip to content

Instantly share code, notes, and snippets.

@ntoll
Created February 14, 2020 16:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ntoll/3b6d380c732711347aad5dd357905394 to your computer and use it in GitHub Desktop.
Save ntoll/3b6d380c732711347aad5dd357905394 to your computer and use it in GitHub Desktop.
from django.db import models
class Musician(models.Model):
first_name = models.CharField(max_length=50)
last_name = models.CharField(max_length=50)
instrument = models.CharField(max_length=100)
class Album(models.Model):
artist = models.ForeignKey(Musician, on_delete=models.CASCADE)
name = models.CharField(max_length=100)
release_date = models.DateField()
num_stars = models.IntegerField()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment