Using 2026.3.3, python 3.12, django 5
I am trying to set up a simple ChoiceField with either TextChoices or a list of tuples to populate choices. This is to replace
self.fields["assay"] = forms.ChoiceField(choices=choices, required=True)
which gives me a usual dropdown with choices.
The following section with a django ChoiceField and a TomSelectIterablesWidget :
from django.db.models import TextChoices
class Status(TextChoices):
DRAFT = 'D', 'Draft'
PUBLISHED = 'P', 'Published'
ARCHIVED = 'A', 'Archived'
self.fields["assay"] = forms.ChoiceField(
choices=Status.choices,
required=True,
widget=TomSelectIterablesWidget(
config=TomSelectConfig(
plugin_dropdown_header=PluginDropdownHeader(
title="Select assay"
)
)
)
)
gives rise to an error:
Reverse for 'autocomplete' not found. 'autocomplete' is not a valid view function or pattern name.
I tried setting url=None or url='' in the config, but this does not appear to work.
I also tried the dedicated TomSelectChoiceField, as follows (with and without a config)
choices = zip(assaynameslist, assaynameslist)
self.fields["assay"] = TomSelectChoiceField(
choices=choices,
required=True,
#config=TomSelectConfig(
# url="",
# placeholder="Start typing to select an assay...",
#),
)
which gives rise to same error.
Is this a bug? I assumed it would use the supplied choices, rather than require an autocomplete url.
Any help appreciated!
PS - I have used TomSelectModelChoiceField and TomSelectModelMultipleChoiceField successfully, they work great (thank you for these).
Using 2026.3.3, python 3.12, django 5
I am trying to set up a simple ChoiceField with either TextChoices or a list of tuples to populate choices. This is to replace
which gives me a usual dropdown with choices.
The following section with a django
ChoiceFieldand aTomSelectIterablesWidget:gives rise to an error:
I tried setting
url=Noneorurl=''in the config, but this does not appear to work.I also tried the dedicated
TomSelectChoiceField, as follows (with and without a config)which gives rise to same error.
Is this a bug? I assumed it would use the supplied choices, rather than require an autocomplete url.
Any help appreciated!
PS - I have used
TomSelectModelChoiceFieldandTomSelectModelMultipleChoiceFieldsuccessfully, they work great (thank you for these).