Oh, how could I miss that. Now I see it. Thanks :)
To submit multiple values for a given key – for example, to specify the
> selections for a <select multiple> – provide the values as a list or
> tuple for the required key. For example, this value of data would submit
> three selected values for the field named choices:
> {'choices': ('a', 'b', 'd')}
On Saturday, March 9, 2013 3:34:19 AM UTC+1, Russell Keith-Magee wrote:
>
>
>
> On Fri, Mar 8, 2013 at 7:52 PM, galgal <[email protected] <javascript:>
> > wrote:
>
>> As in the topic - how can I prepare POST data dictionary in TestCase to
>> send it via POST?
>> I can see how it works in real admin POST in Chrome:
>>
>> ------WebKitFormBoundaryEXChB8PRJPhaP3OQ
>> Content-Disposition: form-data; name="visibly_usergroup" 1
>> ------WebKitFormBoundaryEXChB8PRJPhaP3OQ
>> Content-Disposition: form-data; name="visibly_usergroup" 2
>> ------WebKitFormBoundaryEXChB8PRJPhaP3OQ
>> Content-Disposition: form-data; name="visibly_usergroup" 5
>>
>> How to simulate that?
>>
>
> Hi,
>
> You don't need to concern yourself about the POST data encoding -- you
> just pass in a list of values instead of a single value to the data
> argument in the test client.
>
> self.client.post('/your/url/here'/, data={'visibly_usergroup':
> ['1','2','5']}
>
> This is all covered in the docs; specifically on the section on POST
> operation of the test client:
>
>
> https://docs.djangoproject.com/en/1.5/topics/testing/overview/#django.test.client.Client.post
>
> Yours,
> Russ Magee %-)
>
>
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.