Weird behaviour when using queryset class attributes and overriding get_queryset

Summary

On some views, we use the queryset class attribute together with an overridden get_queryset method. When using the queryset class attribute inside the overridden get_queryset method, there are some strange behaviors to observe. It seems like referencing self.queryset in the get_queryset method leads to some sort of cache invalidation.

What is the expected correct behavior?

Calling get_queryset should always return an up-to-date query resembling the current database's state.

Possible fixes

  • Don't use queryset attributes and get_queryset together
  • find out how the original get_queryset works, then maybe update the queryset saved in the class attribute before further processing