Questions tagged [modelmultiplechoicefield]

12 questions
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( …
1
vote
1 answer

Django ModelMultipleChoiceField problem to save data in DB

I used to have a Multi select box in my form filled with a JSON list forms.py FRUIT_CHOICES= [ ('Oranges', 'Oranges'), ('Cantaloupes', 'Cantaloupes'), ('Mangoes', 'Mangoes'), ('Honeydews', 'Honeydews') ] class…
Nico44044
  • 125
  • 8
1
vote
0 answers

Power apps. Retrieve values of record with multiple choices in SharePoint list column for a dropdown box

For reference I have recreated this app https://www.matthewdevaney.com/make-a-power-apps-approvals-form/ I changed the equipment column to have multiple values and now some code dosent work because the entry is not a record anymore. I think it is a…
1
vote
1 answer

Django: ModelMultipleChoiceField is applying underlying model's max_length validator to total length of selected results

I'm using a ModelMultipleChoiceField to allow users to select certain model objects to delete. It works fine when a single object is selected, but when multiple objects are selected then a validation error is triggered: "Ensure this value has at…
Andrew H
  • 35
  • 1
  • 6
1
vote
0 answers

Django SessionWizardView ModelMultipleChoiceField issue

I am implementing formtools.wizard.views and on first form i have a ModelMultipleChoiceField when i select an option and move to next step i am able to get selected option but when ever i move to the previous step and when submit the form it gives…
1
vote
1 answer

Django ModelMultipleChoiceField gives me a ProgrammingError

I would like to get your help because I'm getting an issue which is a little bit weird to my mind. I'm using Django 1.11.16 I have in my forms.py file this class : class PublicationStatForm(forms.Form): # publication_list =…
Essex
  • 6,042
  • 11
  • 67
  • 139
0
votes
1 answer

Django Form ModelMultipleChoiceField issue with saving data to db

I am creating my first proper Django application. It is a Library management system. I have three models: class Authors(models.Model): firstName = models.CharField(max_length=20) lastName = models.CharField(max_length=20) def…
0
votes
1 answer

How do i pass list to ModelMultipleChoiceField

This is the participant selection form class EventFormAdmin(ModelForm): name = forms.TextInput(attrs={'class':'form-control'}), manager = forms.Select(attrs={'class':'form-select'}), venue =…
Pavik
  • 13
  • 4
0
votes
0 answers

how to use choicefield in django

i have table in db in which i stores countries and i dynamically pass those countries in template and and in forms.pt i have a ChoiceField(widget=forms.Select,required=True) like this but i didnot get the value from this filed but when i chane it…
0
votes
1 answer

Django save ManyToManyField Model with ModelMultipleChoiceField

So I know there are a few similar questions but none of the solutions worked for me. I've tried save(commit=false) and save_m2m as well as a bunch of other stuff but i get the error NOT NULL constraint failed: home_services.managers_id Anyways…
Orbital
  • 565
  • 3
  • 13
0
votes
1 answer

how to receive modelform_instance.cleaned_data['ManyToMany field'] in view when form field is ModelMultipleChoiceField?

Here is the situation: I have a model as below: class School(Model): name = CharField(...) Permit model has three objects: School.objects.create(name='school1') # id=1 School.objects.create(name='school2') # id=2 I have another…
0
votes
1 answer

App works with ModelChoiceField but does not work with ModelMultipleChoiceField

I am trying to retrieve user input data in a django page. But I am unable to choose to multichoice field. I have tried multiple alternatives to no…