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

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -