#30153: ModelAdmin with custom widgets, inlines, and filter_horizontal can merge
media in broken order
-------------------------------+------------------------------------
Reporter: roybi | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 2.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Comment (by Matthias Kestenholz):
Replacing the patch with
https://code.djangoproject.com/attachment/ticket/30153/test.2.patch
because Django 2.2 and 3 will not use jquery in date fields anymore and
therefore cannot be used to demonstrate the problem. I changed the code to
use a `filter_horizontal` widget and now it fails again:
{{{
======================================================================
ERROR: test_inline_media_only_inline (admin_inlines.tests.TestInlineMedia)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/python3.6/unittest/case.py", line 59, in testPartExecutor
yield
File "/usr/lib/python3.6/unittest/case.py", line 605, in run
testMethod()
File "/home/matthias/Projects/django/tests/admin_inlines/tests.py", line
495, in test_inline_media_only_inline
response = self.client.get(change_url)
File "/home/matthias/Projects/django/django/test/client.py", line 535,
in get
response = super().get(path, data=data, secure=secure, **extra)
File "/home/matthias/Projects/django/django/test/client.py", line 347,
in get
**extra,
File "/home/matthias/Projects/django/django/test/client.py", line 422,
in generic
return self.request(**r)
File "/home/matthias/Projects/django/django/test/client.py", line 503,
in request
raise exc_value
File "/home/matthias/Projects/django/django/core/handlers/exception.py",
line 34, in inner
response = get_response(request)
File "/home/matthias/Projects/django/django/core/handlers/base.py", line
115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/home/matthias/Projects/django/django/core/handlers/base.py", line
113, in _get_response
response = wrapped_callback(request, *callback_args,
**callback_kwargs)
File "/home/matthias/Projects/django/django/contrib/admin/options.py",
line 604, in wrapper
return self.admin_site.admin_view(view)(*args, **kwargs)
File "/home/matthias/Projects/django/django/utils/decorators.py", line
142, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/home/matthias/Projects/django/django/views/decorators/cache.py",
line 44, in _wrapped_view_func
response = view_func(request, *args, **kwargs)
File "/home/matthias/Projects/django/django/contrib/admin/sites.py",
line 223, in inner
return view(request, *args, **kwargs)
File "/home/matthias/Projects/django/django/contrib/admin/options.py",
line 1635, in change_view
return self.changeform_view(request, object_id, form_url,
extra_context)
File "/home/matthias/Projects/django/django/utils/decorators.py", line
45, in _wrapper
return bound_method(*args, **kwargs)
File "/home/matthias/Projects/django/django/utils/decorators.py", line
142, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/home/matthias/Projects/django/django/contrib/admin/options.py",
line 1520, in changeform_view
return self._changeform_view(request, object_id, form_url,
extra_context)
File "/home/matthias/Projects/django/django/contrib/admin/options.py",
line 1594, in _changeform_view
media = media + inline_formset.media
File "/home/matthias/Projects/django/django/forms/widgets.py", line 135,
in __add__
combined._js = self.merge(self._js, other._js)
File "/home/matthias/Projects/django/django/forms/widgets.py", line 126,
in merge
MediaOrderConflictWarning,
django.forms.widgets.MediaOrderConflictWarning: Detected duplicate Media
files in an opposite order:
admin/js/inlines.min.js
admin/js/jquery.init.js
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30153#comment:9>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/065.121332ecc5c406f76dc305d654ca5000%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.