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

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -