Merge pull request #112 from Thermondo/master

fix slow get_is_sortable when using with inline admins
master
Brandon Taylor 2015-11-11 12:02:52 -05:00
commit 5ed9e18e08
1 changed files with 7 additions and 5 deletions

View File

@ -6,12 +6,14 @@ def check_inheritance(obj):
def get_is_sortable(objects):
if objects:
if check_inheritance(objects[0]):
if objects.count() > 1:
return True
if objects.count() < 2:
return False
if not check_inheritance(objects[:1][0]):
return False
return True
def is_self_referential(cls):
cls_type = type(cls)