Hi,
have to try to convert the QueryDict to dictionary?
then try to get the keys as list.
>>> qdict
<QueryDict: {u'allergies[0][date]': [['']], u'allergies[1][subst]': [['alcohol']], u'allergies[0][subst]': [['nsaid']], u'allergies[1][date]': [['']]}>
>>> qdict.dict()
{u'allergies[0][date]': [''], u'allergies[1][date]': [''], u'allergies[0][subst]': ['nsaid'], u'allergies[1][subst]': ['alcohol']}
>>> qdict.dict().keys()
[u'allergies[0][date]', u'allergies[1][date]', u'allergies[0][subst]', u'allergies[1][subst]']
>>>
still need some work to detect the list index and further keys, but now you can compare which way is easier to parse manually or serialize via json.
--
sincerely,
O
On Mon, Nov 5, 2018 at 7:16 PM Joel Mathew <joel@joel.su> wrote:
Is it possible to read serialized data from javascript without encoding to json?
The data received by request.POST is:
<QueryDict: {'allergies[0][subst]': ['nsaid'], 'allergies[0][date]':
[''], 'allergies[1][subst]': ['alcohol'], 'allergies[1][date]': ['']}>
Sincerely yours,
Joel G Mathew
--
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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAA%3Diw_9FW8QshYa9_K3rYMc%2BMF5vigZC3KdBFExvdH%2Bqves6ZA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CACUNLpXqAzZr2u16VTdFVBAmDbha60PZMXY%3DEwGo17bgHBQrfg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment