-
Notifications
You must be signed in to change notification settings - Fork 18
OrderableTabularInline breaks when another inline is present: sortable is not a function #62
Copy link
Copy link
Open
Description
Hi, thanks for the library.
I found an issue with OrderableTabularInline in Django admin when the parent ModelAdmin has more than one inline.
Actual behavior
On the change form, JavaScript throws:
jQuery.Deferred exception: ... .sortable is not a function
When there are two inlines:
- one OrderableTabularInline
- one regular TabularInline
If I remove the second inline, drag and drop starts working again.
Expected behavior
OrderableTabularInline should work reliably with multiple inlines on the same admin form, without JavaScript errors.
Likely cause
The package Media currently injects legacy external scripts from CDN:
- jQuery 1.11.2
- jQuery UI 1.11.2
In modern Django admin, django.jQuery and global jQuery may differ, and sortable can be attached to a different jQuery instance than the one used in inline initialization.
Environment
- Django 5.x
- django-orderable 6.1.2
- Chrome
- Admin change form with two inlines (orderable + regular)
Steps to reproduce
- Create a parent ModelAdmin with two inlines:
- Inline A: OrderableTabularInline with sort_order
- Inline B: regular TabularInline
- Open parent change form in Django admin
- Check console, see error: sortable is not a function
- Remove Inline B and reload
- Drag and drop works again
Notes
I can help test a patch if needed.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels