Fixed access of custom order property in model meta, falling back to order for legacy implementations.

Updated readme and version bump to 2.0.10
This commit is contained in:
Brandon Taylor
2016-01-27 10:58:58 -05:00
parent b8a5238a09
commit 66c73a6bdc
5 changed files with 24 additions and 13 deletions
+4
View File
@@ -1,4 +1,8 @@
<<<<<<< Updated upstream
VERSION = (2, 0, 8) # following PEP 386
=======
VERSION = (2, 0, 10) # following PEP 386
>>>>>>> Stashed changes
DEV_N = None
+7 -1
View File
@@ -188,7 +188,13 @@ class SortableAdmin(SortableAdminBase, ModelAdmin):
# Order the objects by the property they are sortable by,
# then by the order, otherwise the regroup
# template tag will not show the objects correctly
objects = objects.order_by(sortable_by_expression, 'order')
try:
order_field_name = opts.model._meta.ordering[0]
except IndexError:
order_field_name = 'order'
objects = objects.order_by(sortable_by_expression, order_field_name)
try:
verbose_name_plural = opts.verbose_name_plural.__unicode__()