jrief / django-admin-sortable2

Generic drag-and-drop ordering for objects in the Django admin interface
https://django-admin-sortable2.readthedocs.io/en/latest/
Other
770 stars 180 forks source link

Question: how to use drag-drop and list_editable together? #262

Closed iremsha closed 3 years ago

iremsha commented 3 years ago

I can show 2 column order (drag-drop) and _order (just number) together, but maybe you have some idea how do field _order editable from list. I want set value in two ways.

class ToolAdmin(admin.ModelAdmin):
   list_editable = ('order',)
   list_display = ('title_en', '_order', 'order')

    def _oreder(self, obj):
        return obj.order
jrief commented 3 years ago

Setting the order manually is a very bad idea, because inevitably you will create entities with the same order value.