mirror of
https://github.com/jazzband/django-admin-sortable.git
synced 2026-03-17 06:20:33 +00:00
Fix bug when used with descending order
This commit is contained in:
parent
736454287e
commit
995baee2d3
1 changed files with 2 additions and 1 deletions
|
|
@ -248,7 +248,8 @@ class SortableAdmin(SortableAdminBase, ModelAdmin):
|
|||
|
||||
order_field_name = klass._meta.ordering[0]
|
||||
|
||||
if '-' in order_field_name:
|
||||
if order_field_name.startswith('-'):
|
||||
order_field_name = order_field_name[1:]
|
||||
step = -1
|
||||
start_object = max(objects_dict.values(),
|
||||
key=lambda x: getattr(x, order_field_name))
|
||||
|
|
|
|||
Loading…
Reference in a new issue