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

autocomplete_search_field does not work with snippets #178

Open
frague59 opened this issue Jan 31, 2024 · 1 comment
Open

autocomplete_search_field does not work with snippets #178

frague59 opened this issue Jan 31, 2024 · 1 comment

Comments

@frague59
Copy link

Hi,

I'm trying to use an AutocompletePanel to select a model instance from a snippet.

I've seen in the doc I can use the autocomplete_search_field to use a field NOT named title, here name

class SideDish(models.Model):
    name = models.CharField(max_length=255)
    
    class Meta:
        ordering = ('name',)
        
    panels = [...]
    
    autocomplete_search_field = "name"


class Menu(ClusterableModel):
    ...
    side_dishes = models.ManyToManyField(SideDish)
    
    ...
    
    panels = [
        ...
        AutocompletePanel("side_dishes")
        ...

This feature does not work, I've a django error.

Thanks for your help !

@frague59 frague59 changed the title Trouble using an AntocompletePanel on a Snippet autocomplete_search_field does not work with snippets Jan 31, 2024
@muvalika
Copy link

During considering the "SideDish" model before the Menu model, you ensure that the SideDish model is available when creating the many-to-many relationship.

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