Skip to content

Instantly share code, notes, and snippets.

@egitimplus
Last active November 5, 2020 21:27
Show Gist options
  • Save egitimplus/d9ef712ff90ccb72600542ee3699931e to your computer and use it in GitHub Desktop.
Save egitimplus/d9ef712ff90ccb72600542ee3699931e to your computer and use it in GitHub Desktop.
from django.db import models
from polymorphic.models import PolymorphicModel
class Audio(PolymorphicModel):
name = models.CharField(max_length=255)
class Sony(Audio):
pass
class Pioneer(Audio):
pass
class Car(models.Model):
name = models.CharField(max_length=255)
audio = models.ForeignKey(Audio, on_delete=models.CASCADE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment