Login

Snippets by wahuneke

Snippet List

Remove a clause from a queryset

I want to create Mixins for QuerySet objects that will by default filter out certain records (e.g. filter out "deleted" records, or filter out "unapproved" records, etc). I'd like those to be separate independent mixins. So in each of those, I override all() to filter out deleted or unapproved, etc. But, I also want to offer a method in the queryset to remove those filters or remove some part of those filters. That's where this code comes in. After some examination of how QuerySets work, this seemed like the simplest method for "undoing" some filter in a queryset

  • hack
  • orm
  • manager
  • mixin
  • queryset
Read More

wahuneke has posted 1 snippet.