1👍
✅
Changed the return statement to the following:
return HttpResponse(simplejson.dumps({'results': vehicle_code_list}, sort_keys=True), mimetype="application/json")
Thought I had tried that already and no luck but this seems to be working.
0👍
The sorted method returns a list type. You can recast the list that is returned from the sorted method back to a dictionary using the following code.
List to dictionary code
dict(sorted(vehicle_code_list.iteritems(), key=operator.itemgetter(0)))
- [Answer]-Wagtail/Django: This page could not be created due to validation errors
- [Answer]-Django user audit
- [Answer]-How do I include django license in my project?
- [Answer]-Django cms display plugin data in template
- [Answer]-Django smart selects
Source:stackexchange.com