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:
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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__()
|
||||
|
||||
Reference in New Issue
Block a user