mirror of
https://github.com/jazzband/django-admin-sortable.git
synced 2026-04-05 15:31:03 +00:00
Refactored check for ordering information to keep backwards compatibility with Django 1.5.x
This commit is contained in:
parent
15d8f20178
commit
a7a6c12deb
1 changed files with 4 additions and 1 deletions
|
|
@ -191,7 +191,10 @@ class SortableAdmin(SortableAdminBase, ModelAdmin):
|
|||
|
||||
try:
|
||||
order_field_name = opts.model._meta.ordering[0]
|
||||
except IndexError:
|
||||
except (AttributeError, IndexError):
|
||||
# for Django 1.5.x
|
||||
order_field_name = opts.ordering[0]
|
||||
finally:
|
||||
order_field_name = 'order'
|
||||
|
||||
objects = objects.order_by(sortable_by_expression, order_field_name)
|
||||
|
|
|
|||
Loading…
Reference in a new issue