I have a third-party function which gives me a filtered queryset (e.g. records with ‘valid’=True) but I want to remove a particular condition (e.g. to have all records, both valid and invalid).
Is there a way to remove a filter condition to an already-filtered queryset?
E.g.
only_valid = MyModel.objects.filter(valid=True)
all_records = only_valid.**remove_filter**('valid')
(I know that it would be better to define ‘all_records’ before ‘only_valid’, but this is just an example…)
From the docs:
I doubt therefore, that there is a standard way to do it. You could dig into the code, see, what
filter()does and try a bit. If that doesn’t help, my assumption is, you’re out of luck and need to re-build the query yourself.