django - How to check if number_id is in a.myid? -
this model:
class a(models.model): number = models.floatfield(..) myid = models.integerfield() class b(models.model): name = models.charfield(..) number_id = models.integerfield()
queryset:
a = a.objects.all()
my try:
b = b.objects.filter(number_id__in=a.myid)
how check if number_id
in a.myid
?
you should use foreign key show type of relationship:
class a(models.model): number = models.floatfield(..) myid = models.integerfield() class b(models.model): name = models.charfield(..) number = models.foreignkey('a')
...and checking done automatically @ db level; impossible add relationship other 'a' class.
Comments
Post a Comment