[Answered ]-Django Admin Sortable 2 โ€“ Inline Tabular โ€“ not save order and display hidden field

1๐Ÿ‘

โœ…

I found out the hint for this problem in a little unrelated issue here: https://github.com/jrief/django-admin-sortable2/issues/106

I had specified a "formset" in my TabularInline admin class. So, I just tried inheriting my inline formset class with "CustomInlineFormSet" class of django-admin-sortable2. Which solved the problem for me.

from adminsortable2.admin import CustomInlineFormSet, SortableInlineAdminMixin

class ABCInlineFormSet(CustomInlineFormSet, BaseInlineFormSet):
    ...
    pass


class ABCAdminInline(SortableInlineAdminMixin, admin.TabularInline):
    formset = ABCInlineFormSet
    model = models.MyModel
    fields = ["your_field"]
    ...

Leave a comment