Closed neerajsharma7 closed 9 years ago
Hello,
I'm afraid you can't filter the queryset for the tree using the get_query method.
Perhaps I could add a filter_tree_queryset that you can optionally override:
class MyAdmin(DjangoMpttAdmin):
def filter_tree_queryset(self, queryset):
return queryset.filter(dept__id=10)
Would this be helpful?
Greetings, Marco
yeah if this works then please do this. Thanks in advance :)
I added it to the latest version on github.
Thanks, Its working fine for me :)
Hi, First of all thanks to you guys. i am using django mptt admin and its working fine for me. but, there is a problem in tree admin view. i want to display selected records in tree view, for this i have override "def queryset(self, request)" in admin view, filtered records are coming is grid view but tree view still displaying all records. please find the code below.
def queryset(self, request): qs = super(EmpAdmin, self).queryset(request) return qs.filter(dept__id=10)
so only those records should be displayed in tree format in which dept_id is 10, but its displaying all records.