Skip to content

Instantly share code, notes, and snippets.

@greylurk
Created April 18, 2012 21:27
Show Gist options
  • Save greylurk/2416699 to your computer and use it in GitHub Desktop.
Save greylurk/2416699 to your computer and use it in GitHub Desktop.
Inheritance sample
from django.db import models
class Profile(models.Model):
title = models.CharField(max_length=200)
class UserProfile(Profile):
user = models.OneToOneField('auth.user')
class OrganizationProfile(Profile):
users = models.ManyToManyField('auth.user')
class Post(models.Model):
profile = models.ForeignKey(Profile)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment