def prep_for_freeze(model):
 fields = modelsinspector.get_model_fields(model, m2m=True)
 for (name, field) in fields.items():
  fields[name] = remove_useless_attributes(field)
 fields['Meta'] = remove_useless_meta(modelsinspector.get_model_meta(model))
 fields['Meta']['object_name'] = model._meta.object_name
 if (not getattr(model._meta, 'managed', True)):
  fields['Meta']['managed'] = repr(model._meta.managed)
 return fields

def prep_for_freeze ( model ) : fields = modelsinspector . get_model_fields ( model , m2m = True ) for ( name , field ) in fields . items ( ) : fields [ name ] = remove_useless_attributes ( field ) fields [ 'Meta' ] = remove_useless_meta ( modelsinspector . get_model_meta ( model ) ) fields [ 'Meta' ] [ 'object_name' ] = model . _meta . object_name if ( not getattr ( model . _meta , 'managed' , True ) ) : fields [ 'Meta' ] [ 'managed' ] = repr ( model . _meta . managed ) return fields
takes a model and returns the ready-to-serialise dict .