Last active
October 19, 2019 13:38
-
-
Save icarovirtual/817125e1f4fa4de381f106cf2361f956 to your computer and use it in GitHub Desktop.
Revisions
-
icarovirtual revised this gist
Oct 19, 2019 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,4 @@ def copy_queryset_without_annotations(original_qs): # Create a new queryset based on the same model optimized_qs = original_qs.model.objects.all() # Copy the filters -
icarovirtual revised this gist
Oct 7, 2019 . No changes.There are no files selected for viewing
-
icarovirtual created this gist
Oct 7, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ def copy_queryset_without_annotations(original_qs): """ Create a new queryset copying the filters but without annotations. """ # Create a new queryset based on the same model optimized_qs = original_qs.model.objects.all() # Copy the filters optimized_qs.query.where = original_qs.query.where optimized_qs.query.where_class = original_qs.query.where_class return optimized_qs