Closed mbi closed 9 months ago
All modified lines are covered by tests :white_check_mark:
Comparison is base (
421c86b
) 76.43% compared to head (bfa7045
) 76.43%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
@mbi Is there any way to test this? How did you test?
@fsbraun I tested manually, i.e. with an Django admin inline containing a FilerImageField.
Without the patch, when you add a new row and drag a file onto the field, it doesn't react. With the PR applied, the field will react correctly and upload the file when dropped.
Did you check it runs on Django 3.2? Probably we can drop the support for Django < 1.9, too. I think the if statement in line 165 and the else block in lines 190+ can go away:
@fsbraun I just tested this on a 3.2 project, it works fine (as it was before: the new code line only triggers on 4.1+) I also remove the two blocks supporting Django < 1.9
Thanks, @mbi ! Great work!
Description
Django 4.1 changed the JavaScript event type being fired when adding a new formset from a jQuery to a vanilla JavaScript event. https://docs.djangoproject.com/en/4.1/ref/contrib/admin/javascript/
This broke the drag-and-drop feature when adding dynamic inlines containing Filer fields in e.g. the Django admin, because the dropzone failed to initialize.
This patch checks for Django 4.1 and initializes the dropzone on newly added inline rows.
Related resources
This fixes #1400.
Checklist
master