Re: QueryDict and ordering

2018-01-08 Thread Ole Laursen
2018-01-05 19:24 GMT+01:00 Tim Graham : > Preservation of dict ordering is guaranteed in Python 3.7+ so that > officially fixes this, correct? > https://mail.python.org/pipermail/python-dev/2017-December/151283.html Sure, I can wait for that. Sorry for the noise, I should read that list more often

Re: QueryDict and ordering

2018-01-06 Thread Todor Velichkov
Is this what you are looking for? from django.http import QueryDict from collections import OrderedDict class OrderedQueryDict(QueryDict, OrderedDict): pass my_dict = OrderedQueryDict(request.META['QUERY_STRING']) print my_dict.items() On Friday, January 5, 2018 at 5:07:41 PM UTC+2, Ole

Re: QueryDict and ordering

2018-01-05 Thread Tim Graham
Preservation of dict ordering is guaranteed in Python 3.7+ so that officially fixes this, correct? https://mail.python.org/pipermail/python-dev/2017-December/151283.html On Friday, January 5, 2018 at 1:14:03 PM UTC-5, Ole Laursen wrote: > > 2018-01-05 17:12 GMT+01:00 Tim Graham >: > > Hi, Did yo

Re: QueryDict and ordering

2018-01-05 Thread Ole Laursen
2018-01-05 17:12 GMT+01:00 Tim Graham : > Hi, Did you try writing a patch? I naively tried "class > MultiValueDict(OrderedDict):" as the only change and it doesn't pass the > tests. Perhaps more adaptations are required. Tried just now, and yeah it takes a little more adaptation. MultiValueDict is

Re: QueryDict and ordering

2018-01-05 Thread Tim Graham
Hi, Did you try writing a patch? I naively tried "class MultiValueDict(OrderedDict):" as the only change and it doesn't pass the tests. Perhaps more adaptations are required. As for the motivation, I'm not sure if you described the problem in enough detail. (i.e. what does "It makes highly dyna

QueryDict and ordering

2018-01-05 Thread Ole Laursen
Hi! Would it be possible to derive QueryDict (i.e. MultiValueDict) from an OrderedDict instead of dict? I'm finding it increasingly irritating that the original order is kept by the whole stack right until Django puts it into a dict. It makes some highly dynamic form situations more tedious to