python - Django Orm Related Table Condition -


I have a table foo that is related to table bar, how can I filter it in Django Orm?

Raw query:

  select from foo as a *, bar as b where a.bar_id = b.id and b.is_deleted = 0  

Django Orm:

  Foo.objects.filter (& lt; bar_is_deleted & gt; = 0)  

  Foo.objects.filter (bar__is_deleted = False)  

Comments

Popular posts from this blog

HTML/CSS - Automatically set height width from background image? -

php - Mysql Show Process - Sleep Commands and what to do -

c - What is the address of buf (the local variable in the main function)? -