开发者

Django: Problem reading multi valued POST variable

I'm missing something obvious here. I am trying to process a POST request that contains a mixture of single value and multi value variables. I can get the single valued variables开发者_如何学Go using request.POST.get('variable_name'), for example:

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

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

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

I can't show all the fields in the request here, because it's work for a client. However this log call:

logging.debug(repr(request.POST)) 

gives this output (start only)

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

By the way, the request I'm trying to process is an IPN (Instant Payment Notification) from a payment processing service.


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

This should do the trick.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜