You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
simone edited this page Jun 30, 2012
·
17 revisions
AIM
Use Django with embedded database that have composite multicolumn primary key and multiple foreignkeys
Low coupling with this specific API
PK API
from compositekey import db
class Blog(models.Model):
id = db.MultiFieldPK("title", "author")
title = models.CharField(max_length=100)
author = models.CharField(max_length=100)
FK API
class Post(models.Model):
title = models.CharField(max_length=100)
a_blog = models.ForeignKey(Blog)
the_blog = models.OneToOneField(Blog)
blogs = models.ManyToManyField(Blog)