[Answer]-Django passing post variables

1👍

I don’t know what the order is for but you can sort the request.POST dict (standard Python dicts don’t have order) like this:

for k, v in sorted(request.POST.iteritems()):
    if k.startswith('inp'):
        elems = v.split(',')
        lon = ''.join(elems[-1:])
        lat = ''.join(elems[:-1])
        coordinates_l.append(lat)
        coordinates_l.append(lon)

Hope it helps.

Leave a comment