From 011eb24017194eb5e22c7656038d12e0369f8524 Mon Sep 17 00:00:00 2001 From: Jamie Matthews Date: Tue, 20 Apr 2021 10:59:42 +0100 Subject: [PATCH] Use a better way to represent unknown queryset filters --- django_readers_debug/__init__.py | 2 +- tests/data/example.txt | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/django_readers_debug/__init__.py b/django_readers_debug/__init__.py index 011dd60..eed0dd7 100644 --- a/django_readers_debug/__init__.py +++ b/django_readers_debug/__init__.py @@ -60,7 +60,7 @@ def handle_auto_prefetch_relationship(fn): def format_queryset(queryset): - return f"{queryset.model.__name__}.objects.__some_queryset__()" + return f"{queryset.model.__name__}.objects.__(...)" def format_prefetch_arg(arg): diff --git a/tests/data/example.txt b/tests/data/example.txt index 41b229b..f91be21 100644 --- a/tests/data/example.txt +++ b/tests/data/example.txt @@ -13,30 +13,26 @@ qs.pipe( qs.distinct(), qs.prefetch_related(models.Prefetch("collections")), qs.prefetch_related( - models.Prefetch( - "owner", queryset=User.objects.__some_queryset__(), to_attr="owner" - ) + models.Prefetch("owner", queryset=User.objects.__(...), to_attr="owner") ), qs.pipe( qs.include_fields("co_author"), qs.prefetch_related( models.Prefetch( - "co_author", - queryset=User.objects.__some_queryset__(), - to_attr="coauthor", + "co_author", queryset=User.objects.__(...), to_attr="coauthor" ) ), ), qs.pipe( qs.include_fields("pk"), qs.prefetch_related( - models.Prefetch("publisher", queryset=User.objects.__some_queryset__()) + models.Prefetch("publisher", queryset=User.objects.__(...)) ), ), qs.pipe( qs.include_fields("pk"), qs.prefetch_related( - models.Prefetch("collaborators", queryset=User.objects.__some_queryset__()) + models.Prefetch("collaborators", queryset=User.objects.__(...)) ), ), some_queryset_function(),