question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

get_queryset not working with admin

See original GitHub issue

Hi, I’ve defined custom get_queryset method for my resource class. I’v set the resource class for my admin class, but when I export data via Django admin the results are not filtered as I want. It seems like my get_queryset method is not evaluated (checked that with print). Everything works fine when I go to Django shell and export the resource manually.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
edmenendezcommented, Feb 13, 2019

I also got the impression reading the docs that I could just override get_queryset to change the query. Then I found this useful issue 😃 The easiest fix may be to just make the docs more clear.

0reactions
stale[bot]commented, Jun 5, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Django model admin custom get_queryset pagination is not ...
In my django code i am displaying user list with custom queryset: class UserAdmin(admin.ModelAdmin): def get_queryset(self, request): qs ...
Read more >
ModelAdmin.get_queryset doesn't accept ValueQuerySet
Django Admin crashes for following code: models.py from django.db import models from django.contrib.auth.models import User class Category(models.
Read more >
2. How to optimize queries in Django admin? - Books by Agiliq
get_queryset method on model admin to annotate the calculated fields. ; ModelAdmin we have for Origin : ; get_queryset to annotate the counted...
Read more >
list_editable" doesn't work in admin changelist view, using ...
Coding example for the question "list_editable" doesn't work in admin changelist view, using custom get_queryset() method-django.
Read more >
How to almost get facet counts in the Django admin
get_queryset (request) - which returns the unfiltered root queryset. Trying to get filtered counts. The challenge here is to get access to the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found