Skip to content

Instantly share code, notes, and snippets.

Alex unthingable

View GitHub Profile
View gist:2897398
AbstractBase(models.Model):
foo = somefield
class Base(AbstractBase):
c1 = models.OneToOneField('C1', null=True, blank=True)
c2 = models.OneToOneField('C2', null=True, blank=True)
def c(self):
#only one additional query to get the base
if self.c1_id:
You can’t perform that action at this time.