Added exception handling for get_queryset attribute.
parent
a5c1c53400
commit
ad09081ab4
|
|
@ -47,7 +47,10 @@ class SortableAdminBase(object):
|
||||||
object_tools block to take people to the view to change the sorting.
|
object_tools block to take people to the view to change the sorting.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
try:
|
||||||
qs_method = getattr(self, 'get_queryset', self.queryset)
|
qs_method = getattr(self, 'get_queryset', self.queryset)
|
||||||
|
except AttributeError:
|
||||||
|
qs_method = self.get_queryset
|
||||||
|
|
||||||
if get_is_sortable(qs_method(request)):
|
if get_is_sortable(qs_method(request)):
|
||||||
self.change_list_template = \
|
self.change_list_template = \
|
||||||
|
|
@ -116,7 +119,10 @@ class SortableAdmin(SortableAdminBase, ModelAdmin):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Apply any sort filters to create a subset of sortable objects
|
# Apply any sort filters to create a subset of sortable objects
|
||||||
|
try:
|
||||||
qs_method = getattr(self, 'get_queryset', self.queryset)
|
qs_method = getattr(self, 'get_queryset', self.queryset)
|
||||||
|
except AttributeError:
|
||||||
|
qs_method = self.get_queryset
|
||||||
objects = qs_method(request).filter(**filters)
|
objects = qs_method(request).filter(**filters)
|
||||||
|
|
||||||
# Determine if we need to regroup objects relative to a
|
# Determine if we need to regroup objects relative to a
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue