Skip to content

Commit

Permalink
Merge pull request #1 from dabapps/change-queryset-repr
Browse files Browse the repository at this point in the history
Use a better way to represent unknown queryset filters
  • Loading branch information
j4mie authored Apr 20, 2021
2 parents f0a8dfe + 61e8c09 commit 98d3ef0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion django_readers_debug/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
12 changes: 4 additions & 8 deletions tests/data/example.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit 98d3ef0

Please sign in to comment.