All pastes #505491 Raw Edit

Stuff

public python v1 · immutable
·published 2007-05-23 16:02 UTC
rendered paste body
from django.db import modelsclass parent(models.Model):	name = models.CharField()class childA(models.Model):	parent = models.ForeignKey(parent)	some_field = models.CharField()class childB(models.Model):	parent = models.ForeignKey(parent)	some_other_field = models.CharField()	some_field = #How to tie to some_field (multiple) from childA with same parent as childB's?#USING manage.py shellp = objects.all()[0] #first parentchildb = p.childB_set.all()[0] #first childB object under pprint childb.parent.childA_set.all() # Returns list of childA objects#How to get the same result in the models.py?