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

MediaChooserPanel not compatible with Wagtail 2 #34

Closed
DanSGraham opened this issue Jun 2, 2018 · 6 comments
Closed

MediaChooserPanel not compatible with Wagtail 2 #34

DanSGraham opened this issue Jun 2, 2018 · 6 comments
Labels

Comments

@DanSGraham
Copy link

The current implementation of MediaChooserPanel does not work in Wagtail 2 as the expected return value for bind_to_model is an object, not a type.

@dfmeyer
Copy link

dfmeyer commented Jul 24, 2018

Yeah I've experience this problem too. The error I got was:
TypeError: required_fields() missing 1 required positional argument: 'self'

My less than ideal workaround was to add a streamfield containing a custom media chooser block that inherits from AbstractMediaChooserBlock.

@DanSGraham
Copy link
Author

DanSGraham commented Dec 20, 2018

I just commented out the bind_to_model method in the edit_handlers and the class method widget_override and it works fine for me. May not be the best way though. I have attached my working edit_handler.
screenshot from 2018-12-19 22-30-48

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

Works in my branch, if you use BaseMediaChooserPanel instead of MediaChooserPanel

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 thibaudcolas reopened this May 8, 2019
@thibaudcolas
Copy link
Member

thibaudcolas commented May 8, 2019

From what I understand this particular issue isn't fixed. #40 would be the fix for this, or as @kaduuuken suggests people can also use BaseMediaChooserPanel instead of MediaChooserPanel.

At the moment the README only mentions MediaChooserPanel, so either the README needs to be updated or we need to merge the changes from #40.

I think my project uses the AdminMediaChooser widget directly with a standard FieldPanel – not entirely sure if/how that differs from the panel extending BaseChooserPanel (it sounds like it might just be a quick workaround for this issue).

@thibaudcolas
Copy link
Member

Fixed in #40, I'll release this shortly.

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

No branches or pull requests

5 participants