Questions tagged [multiplechoicefield]
43 questions
23
votes
4 answers
django ModelMultipleChoiceField set initial values
I have the following code:
category = forms.ModelMultipleChoiceField(
label="Category",
queryset=Category.objects.order_by('name'),
widget=forms.Select(
attrs={
'placeholder': 'Product Category', 'class':…

Chris Hansen
- 7,813
- 15
- 81
- 165
20
votes
1 answer
CMake multiple-option setting
I'm working on a project which is built with CMake, so I'm writing up a CMakeLists.txt for it. In this file I want to have a (cached) CMake variable that can only take one of several options (which I would specify somehow), rather than any arbitrary…

einpoklum
- 118,144
- 57
- 340
- 684
7
votes
2 answers
Reload choices dynamically when using MultipleChoiceFilter
I am trying to construct a MultipleChoiceFilter where the choices are the set of possible dates that exist on a related model (DatedResource).
Here is what I am working with so far...
resource_date = filters.MultipleChoiceFilter(
…

wakey
- 2,283
- 4
- 31
- 58
5
votes
3 answers
Django: Form with list of integers
I have a javascript application (in angular) that calls my django application. It uses lists of integers to filter the response. In Django I'm using a form to clean the data.
Javascript:
app.factory('SearchData',
function(){
…

boingboing
- 161
- 2
- 10
4
votes
1 answer
django CheckboxSelectMultiple: my checkboxes are not checked
I have a ManyToManyField, displayed with checkboxes. Checkboxes should be checked when my boolean field share_data is equal to one.
Here is the code:
class Participant(models.Model):
databases = models.ManyToManyField(Advertiser, null=True,…

rom
- 3,592
- 7
- 41
- 71
4
votes
1 answer
Changing required field in form based on condition in views (Django)
I have a form, LabelingForm() with two multiplechoicefields and I wish to set the required - parameter so that it is False when pressing button A and B but True when pressing button C. I 've tried with initial = False and required = True but it…

user1749431
- 559
- 6
- 21
2
votes
2 answers
Django Form does not load MultipleChoiceField data from ajax POST request
I ve a weird issue with a MultipleChoiceField that does not return the items that are in the POST QueryDict
here is the Form
class TranslationLanguagesForm(forms.Form):
languages = forms.MultipleChoiceField(
…

David
- 492
- 8
- 17
2
votes
1 answer
Django CheckboxSelectMultiple not displaying in ModelForm
I'm trying to use CheckboxSelectMultiple in a form, instead of the SelectMultiple default. I tried two different ways to make it display as checkboxes, but they both display the default SelectMultiple on my local webpage. Everything else renders…

Crowl
- 37
- 5
2
votes
0 answers
Update SharePoint Choice FIeld with VBA
I'm attempting to write a macro that sends info to a SharePoint list through an Excel workbook. However, I can't seem to find language to get it to select the desired value.
Public Function addtoSP(refRow As Integer, ws As Worksheet)
Dim tbl …

RLee
- 106
- 9
1
vote
1 answer
Django get id of the selected checkbox on CheckboxSelectMultiple widget in Javascript
I have checkboxes in Django from a form :
testrever = forms.MultipleChoiceField(required=False,widget=forms.widgets.CheckboxSelectMultiple())
I would like to return only the ID (and then the value) of the last selected checkbox on .change event…

Nico44044
- 125
- 8
1
vote
1 answer
Django how to allow multiple selection without ctrl click
I have a listbox on a Django form
forms.MultipleChoiceField(widget=forms.widgets.SelectMultiple())
How can I enable multiple choice with a simple click to select/unselect , without having to press the ctrl key ?

Nico44044
- 125
- 8
1
vote
1 answer
How to change Django MultipleChoiceField to display multiple data from multiple tables and use specific value
I have 3 relational Django database tables and i want to display data in 'name_en' column in all the tables as labels, and 'id' in city table as value in Django MultipleChoiceField
| Example Table Structure |
Table 1 (province):
| id |…
1
vote
1 answer
Set initial values on ModelMultipleChoiceField CheckboxSelectMultiple widget using list
I have a ModelMultipleChoiceField in a form which is generated with a queryset.
class NewEvaluationPriorityForm(forms.Form):
priority_field = forms.ModelMultipleChoiceField(
queryset=None,
widget=forms.CheckboxSelectMultiple,
…

Mark__C
- 825
- 1
- 13
- 24
1
vote
0 answers
How to pre select django forms.CheckboxSelectMultiple
I am having a MultipleChoiceField to select language choices from a list of 7 languages.
LANGUAGES = (
('en', _('English')),
('pl', _('Polish')),
('da', _('Danish')),
)
Inside my forms.py, I have
language =…

Sudheer K
- 1,244
- 2
- 18
- 31
1
vote
1 answer
DJANGO Trouble to inject the MultipleChoiceField initial value
I've a form, clicking the button "info" from a table, i get the user information and inject into the form, all of this works as well, but not for the MultipleChoiceField:
data = {'name': name_surname[0], 'surname': name_surname[1], 'c02':…

ivoruJavaBoy
- 1,307
- 2
- 19
- 39