If you came here from Google looking for model to dict, skip my question, and just jump down to the first answer. My question will only confuse you.
Is ther
To get a map of all of the instances in a queryset into a single dictionary with a specified model field as the key, try doing this
from django.forms.models import model_to_dict
from myApp.models import myModel
allObjs = myModel.objects.all()
f = {} # initialise the output
key = 'key' # one of the fields from myModel
[f.update({x[key]: x}) for x in [model_to_dict(y) for y in allObjs]]
return f