Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chooser breaks in Wagtail 2.4 #37

Closed
evanwinter opened this issue Dec 10, 2018 · 10 comments
Closed

Chooser breaks in Wagtail 2.4 #37

evanwinter opened this issue Dec 10, 2018 · 10 comments

Comments

@evanwinter
Copy link

Using...
Wagtail 2.4rc1 (release candidate 1)
Django 2.0

When trying to open a Media Chooser modal, the following error is raised:

web_1  | Internal Server Error: /admin/media/chooser/
web_1  | Traceback (most recent call last):
web_1  |   File "/usr/local/lib/python3.6/site-packages/django/core/handlers/exception.py", line 35, in inner
web_1  |     response = get_response(request)
web_1  |   File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 128, in _get_response
web_1  |     response = self.process_exception_by_middleware(e, request)
web_1  |   File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 126, in _get_response
web_1  |     response = wrapped_callback(request, *callback_args, **callback_kwargs)
web_1  |   File "/usr/local/lib/python3.6/site-packages/django/views/decorators/cache.py", line 44, in _wrapped_view_func
web_1  |     response = view_func(request, *args, **kwargs)
web_1  |   File "/usr/local/lib/python3.6/site-packages/wagtail/admin/urls/__init__.py", line 102, in wrapper
web_1  |     return view_func(request, *args, **kwargs)
web_1  |   File "/usr/local/lib/python3.6/site-packages/wagtail/admin/decorators.py", line 34, in decorated_view
web_1  |     return view_func(request, *args, **kwargs)
web_1  |   File "/usr/local/lib/python3.6/site-packages/wagtailmedia/views/chooser.py", line 89, in chooser
web_1  |     'is_searching': False,
web_1  |   File "/usr/local/lib/python3.6/site-packages/wagtail/admin/modal_workflow.py", line 11, in render_modal_workflow
web_1  |     raise TypeError("Passing a js_template argument to render_modal_workflow is no longer supported")
web_1  | TypeError: Passing a js_template argument to render_modal_workflow is no longer supported

The change, along with a note about how to update affected code, is described here (https://docs.wagtail.io/en/v2.3/releases/2.2.html#javascript-templates-in-modal-workflows-are-deprecated).

@DanSGraham
Copy link

DanSGraham commented Dec 24, 2018

Hey Evan,
Development on this package seems to be fairly slow. I have been working on this issue and have almost got it. The only issue I am running into is getting the chooser to work properly. (I saw your fork and when I tested yours I couldn't get the chooser js to open. Mine opens and works somewhat.) I will be working on this until I get it solved, but I don't know how long that will take given my lack of js experience. Give my code a test and see if you would be able to contribute and get this package working again!
Best,
Dan

@yyken
Copy link

yyken commented Dec 26, 2018

Hi Dan,

FYI

Base on your works, I do some changes
https://github.com/yyken/wagtailmedia/commit/9c58cdbb0d836fb6ee3ff1ea968e7b32433f74cf

but I don't know how to send a pull request

Best,
Ken

@DanSGraham
Copy link

DanSGraham commented Dec 26, 2018

Hey yyken,
I updated my code to match those changes and cited you in the commit. Great job!
There are still a few minor fixes that I haven't finished (For example the upload tab on the chooser shouldn't have height and width for audio) but it is functional now I think.
Dan

@evanwinter
Copy link
Author

@DanSGraham I'll give your fork a try today – thanks!

@DanSGraham
Copy link

I have also written a new module -- wagtailaudio -- that does just audio files and has several improvements over the wagtailmedia module. If all you need is audio then take a look at that module!

@evanwinter
Copy link
Author

Hey Dan,

Your (and yyken's) updates are working for me. Thank you, and nice job! 👍🏻

The only issue we ran into is that we have other migrations that relied on wagtailmedia's migrations as dependencies. To get around that, I just forked your fork and reinstated the original migrations.

Out of curiosity–– did you remove the old migrations just for cleanliness' sake? I checked to see if your changes required any new migrations, and it didn't look like they did.

kaduuuken added a commit to anfema/wagtailmedia that referenced this issue Feb 8, 2019
- Eliminate template tags from the .js template. Any dynamic data needed by the template can instead be passed in a dict to render_modal_workflow, as a keyword argument json_data; this data will then be available as the second parameter of the JavaScript function.

Re torchbox#34
Re torchbox#37
@kaduuuken
Copy link
Contributor

I made it work! check out my PR

@maxwaiyaki
Copy link

I have also written a new module -- wagtailaudio -- that does just audio files and has several improvements over the wagtailmedia module. If all you need is audio then take a look at that module!

Kindly include usage documentation.

thibaudcolas pushed a commit to thibaudcolas/wagtailmedia that referenced this issue May 8, 2019
Eliminate template tags from the .js template. Any dynamic data needed by the template can instead be passed in a dict to render_modal_workflow, as a keyword argument json_data; this data will then be available as the second parameter of the JavaScript function.

Re torchbox#34
Re torchbox#37
@zerolab
Copy link
Member

zerolab commented May 8, 2019

Fixed in #43.

@zerolab zerolab closed this as completed May 8, 2019
@thibaudcolas
Copy link
Member

The fix should now be released on PyPI, wagtailmedia==0.3.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants