Skip to content

7.04 and + dropdown menu not populated initialy #568

Closed
@SylvainMartel

Description

@SylvainMartel

Describe the bug
I use select2 to populate a dropdown box from the database, then the value selected populate a second dropdown that is dependent on what is selected in the first one.

Up to v7.03 the widget worked fine with this code

merchandise_cat = forms.ModelChoiceField(label='Merchandise Category', queryset=merchandise_category.objects.all().order_by('cat_name'),
                                         widget=ModelSelect2Widget(
                                            model=merchandise_category,
                                            search_fields=['name__icontains'],
                                            ),
                                        required=False)

but with 7.04 and up, the dropdown box is empty and it asks to enter 2 characters. But in previous version, it would show all the items it would find in the database, it's like it's not loading values from the database until you enter chars now

Exception & Traceback

Code Snippet
Please provide us with a code example on how to reproduce the error.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions