Django: reading the job of a multi-valued POST variable

I'm missing something obvious here. I am trying to process a POST request containing a mixture of variables with one value and several values. I can get single-valued variables using request.POST.get ('variable_name'), for example:

logging.debug('sale_date: ' + request.POST.get('SALEDATE'))

However, I cannot get multi value variables using request.POST.getlist ('variable_name'). For example, the following returns an empty list.

prices = request.POST.getlist("IPN_PRICE")

I cannot show all the fields in the request here because it works for the client. However, this log call:

logging.debug(repr(request.POST)) 

gives this conclusion (only the beginning)

<QueryDict: {u'IPN_PRICE[]': [u'15.76'], ...

By the way, the request I'm trying to process is the IPN (instant payment notification) from the payment processing service.

+3
1
prices = request.POST.getlist("IPN_PRICE[]")

.

+4

Source: https://habr.com/ru/post/1765494/


All Articles