How do I \"pickle\" instances of Django models in a database into sample python code I can use to load sample data?
I want to: 1) Take a snapshot of several hundred
On Django version 1.8 and above, if your models has foreign keys, you can use:
my_dict = dict([(f.attname, getattr(instance, f.attname)) for f in instance._meta.get_fields() if hasattr(f, 'attname')])