Re: request.POST.getlist('xxx') only has one value in ajax request for many2many

2022-01-17 Thread Julio Cojom
I remember having a problem like that once, in your views print the hole dictionary "print(request.POST)", you should see all the values of the field you want as list, not just one. Then instead of getlist try just get, request.POST.get('field_here') Let me know how it goes El lun., 17 de enero

Re: request.POST.getlist('xxx') only has one value in ajax request for many2many

2022-01-17 Thread Campbell McKilligan
Yeah - I am looping. I just get one iteration which is the last item even though the request body has the same key repeated. For example, this code only prints one item, whereas for a different form elsewhere, it would iterate through all the identical keys: print(self.request.__dict__)

Re: request.POST.getlist('xxx') only has one value in ajax request for many2many

2022-01-16 Thread Jason
https://code.djangoproject.com/ticket/1130 Essentially, this is expected behavior, and previous comment is correct. Need to loop through the items in the list On Sunday, January 16, 2022 at 5:42:45 PM UTC-5 richy...@gmail.com wrote: > You might want to loop through the list > Example: > Lists

Re: request.POST.getlist('xxx') only has one value in ajax request for many2many

2022-01-16 Thread Odigiri Richard
You might want to loop through the list Example: Lists = request.getlist('item') For list in Lists: . On Sun, Jan 16, 2022, 9:30 PM Campbell McKilligan wrote: > Hi, > > Using Django 3.2 and Py 3.9 > > I have an ajax request which submits multiple values for a field to an > UpdateView. >

request.POST.getlist('xxx') only has one value in ajax request for many2many

2022-01-16 Thread Campbell McKilligan
Hi, Using Django 3.2 and Py 3.9 I have an ajax request which submits multiple values for a field to an UpdateView. In the request dict body I see both values (in this case, for the pool_list column): '_body': b"csrfmiddlewaretoken=z...h&...&key=...&expiry_datetime=&overflow=555& *pool_list=5