Django: remove a filter condition from a queryset

Posted by Don on Stack Overflow See other posts from Stack Overflow or by Don
Published on 2011-01-14T09:20:30Z Indexed on 2011/01/14 10:53 UTC
Read the original article Hit count: 518

I have a third-part funtion 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...)

© Stack Overflow or respective owner

Related posts about django

Related posts about django-models