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

Limit/filter snippet result set in the SnippetChooserPanel popup. #3900

Closed
corpulent opened this issue Oct 4, 2017 · 1 comment
Closed

Comments

@corpulent
Copy link

Issue Summary

Is it possible to limit/filter the result set of a snippet in the SnippetChooserPanel? I am using this example http://docs.wagtail.io/en/v1.0/reference/pages/editing_api.html#wagtail.wagtailadmin.edit_handers.wagtail.wagtailsnippets.edit_handlers.SnippetChooserPanel. So in my equivalent of advert, what_it_does (below), I try to add limit_choices_to={description_type=1} to limit the ElementDescriptor snippets in the popup to show only the ones that are of descriptor_type 1. But it always lists ALL ElementDescriptors. Any way to work around this?

    what_it_does = models.ForeignKey(
        'ElementDescriptor',
        null=True,
        blank=True,
        on_delete=models.SET_NULL,
        related_name='+',
        help_text='select a snippet from the what it does type',
        verbose_name='What it does',
        limit_choices_to={'descriptor_type': 1}        
    )

and the way I use is:

    content_panels = Page.content_panels + [
        MultiFieldPanel([
            SnippetChooserPanel('what_it_does')
        ])
    ]
@gasman
Copy link
Collaborator

gasman commented Oct 4, 2017

Hi @corpulent,
No, this isn't currently possible - this is covered by #1250.

@gasman gasman closed this as completed Oct 4, 2017
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

2 participants