On 2/10/06, Andrew Degtiariov <[EMAIL PROTECTED]> wrote: > def complete(self, request, data): > debug('complete: %s' %repr(data)) > debug('complete: %s' %repr(data['costs']) > ..... > > First debug() call produced: > complete: <MultiValueDict: {'status': [True], 'pay_type': ['C'], 'name': > ['\xd0\xa2\xd0\xb5\xd1\x81\xd1\x82x'], 'unit_type': ['B'], > 'costs': ['1', '2', '3'], 'frequency': ['D'], 'license_fee': [15.0], > 'setup_fee': [185.0], 'description': > ['\xd0\xa2\xd0\xb5\xd1\x81\xd1\x82\xd0\xbe\xd0\xb2\xd1\x8b\xd0\xb9 > \xd1\x81\xd0\xb5\xd1\x80\xd0\xb2\xd0\xb8\xd1\x81 ']}> > > Please note that the value stored with a 'costs' key is list. > > Second debug() call produced: > complete: '3' > > There is regular string - last value from 'costs'. Don't know is it fixed > or not, if yes, could you give me patch or solution for Django 0.91 > how I can obtain list instead of string?
Hi Andrew, This isn't a bug -- it's intended behavior. When you access an element in a MultiValueDict, it returns the last item, as a string. See the docs for more info: http://www.djangoproject.com/documentation/request_response/#querydict-objects If you want to get a list instead of a string, use data.getlist('costs') instead of data['costs']. Adrian -- Adrian Holovaty holovaty.com | djangoproject.com | chicagocrime.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~---