Skip to content
Advertisement

Tag: django-views

Django many-to-many: Best way to get elements in one related query set but exclude elements in other related query sets?

Consider these related models: In a view, I need to query to get all Bs related to a given A while excluding all Bs related with a set of other As. I need the grey area: My current, grossly inefficient approach is as follows: In my application, previous_As could have nearly 1,000 elements, which makes this approach extremely expensive. Is

Advertisement