Hi,
Below is my code. If I use
widget=forms.CheckboxSelectMultiple or SelectMultiple, it works for me.
But if I use Select or RadioSelect (I want only one to be selected): this doesn't work.
If I use 'Select', I get the list of versions (e.g 5.6 and 5.7). If I select 5.7 and click on 'Upgrade', it returns with a message saying 'Enter the list of values'. Not sure what's wrong with 'Select'?
Thanks in advance.
self.fields[instance_choice[0]] = forms.MultipleChoiceField(
label=_("Available Versions"),
required=False,
widget=forms.
Select(
attrs={'class': 'switched',
'data-switch-on': 'instance',
dataKey: instance_choice[0]}))
# Populate field with choices
version_choices = []
try:
# Retrieve the available datastore versions
ds_versions = trove_api.trove.datastore_version_list(request, instance.datastore['type'])
except Exception as e:
logging.error("%s: Exception received trying to retrieve datastore versions for datastore %s. "
"Exception is: %s",
__method__, instance.datastore['type'], e)
for avail_version in ds_versions:
version_choices.append((
avail_version.name,
avail_version.name))
self.fields[instance_choice[0]].choices = version_choices