Truebosko said it well: [530] i must say you are a man of not-so well known django techniques 🙂
>>>from django.forms.models import model_to_dict
>>>model_to_dict(model_instance)
Out:
{'id': 1,
'name': u'joe'
}
etc.
I’m sure i’ll use it in the future.
I said I’m sure I’d use it in the future, and lo and behold I did.
I used it to populate the context of an email via it’s subscribers.
context=Context(model_to_dict(subscriber_instance))
This needs to be higher on the google results. All the stack overflow solutions re-implement this badly!