-
Notifications
You must be signed in to change notification settings - Fork 70
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
Media Chooser not Appearing #54
Comments
Hey @Aesirry, thanks for the report. I imagine you'd have encountered that when trying to upgrade to the latest version, but it might be useful to get this confirmed. Could you provide the following info:
Additionally, could you provide us with a sample of the code where you use |
Hi @thibaudcolas,
Here is where I use the Base MediaChooserPanel: class VideoPage(Page):
author = models.CharField(max_length=255)
date = models.DateField("Post date")
body = models.TextField(blank=False)
media = models.ForeignKey(
get_media_model_string(),
null=True,
blank=True,
on_delete=models.SET_NULL,
related_name='+'
)
content_panels = Page.content_panels + [
FieldPanel('author'),
FieldPanel('date'),
FieldPanel('body'),
BaseMediaChooserPanel('media')
] I'm using a custom media model by the way. That's where that |
👌 thanks, that will make troubleshooting much easier. In the meantime you might be able to do what my project does, although I'm not sure of the implications: from wagtailmedia.widgets import AdminMediaChooser
[...]
content_panels = Page.content_panels + [
[...]
FieldPanel('media', widget=AdminMediaChooser),
] If that's an issue with 0.3.0 I'm sorry it fell through the cracks. Tried my best to review each and every bit of API of wagtailmedia, but I must've missed that one. |
Hey @thibaudcolas, using I guess for now just using FieldPanel should be enough. Thank you! |
Ah that's really strange 😕 are you sure this isn't just a caching issue with a CDN / the browser? I'll try both options and report back. |
hmm not sure it's a CDN issue since it's on localhost, I'll check the browser |
The fix for #34 (i.e #40) is on the right path
class MediaChooserPanel(BaseChooserPanel):
object_type_name = 'media'
def widget_overrides(self):
return {self.field_name: AdminMediaChooser} The one thing missing from that PR is a shim or deprecation for Context: Slack #support reply. Diff for mentioned repo: master...solarissmoke:wagtail25#diff-7bea8da4a64ce9c5452abd60428fa2c9R8 |
@Aesirry also try to run |
@thibaudcolas I tried creating a brand new site (the previous one had many modifications, including templates). There is another error when I try to use a RichTextField and a media field with the Again for this site the versions are the same:
here's the model: class HomePage(Page):
author = models.CharField(max_length=255, blank=True, null=True)
date = models.DateField("Post date", blank=True, null=True)
body = RichTextField(blank=True, null=True)
media = models.ForeignKey(
'wagtailmedia.Media',
null=True,
blank=True,
on_delete=models.SET_NULL,
related_name='+'
)
content_panels = Page.content_panels + [
FieldPanel('author'),
FieldPanel('date'),
FieldPanel('body'),
FieldPanel('media', widget=AdminMediaChooser),
] I made another model without a class RandomPage(Page):
author = models.CharField(max_length=255, blank=True, null=True)
date = models.DateField("Post date", blank=True, null=True)
body = RichTextField(blank=True, null=True)
content_panels = Page.content_panels + [
FieldPanel('author'),
FieldPanel('date'),
FieldPanel('body')
] I hope this can give you a hint in the right direction 👍 |
@thibaudcolas I spoke over slack with the Wagtail support and it turns out that this is actually an issue with wagtail. Also using |
I've updated the docs as part of #57, sorry you ran into this @Aesirry. |
When Using the BaseMediaChooserPanel as mentioned in #53 the chooser doesn't open when clicking on the "choose a media item" button in the edit page.
The browser console shows this error:
The text was updated successfully, but these errors were encountered: