def serialize_instance(instance):
 ret = dict([(k, v) for (k, v) in instance.__dict__.items() if (not k.startswith('_'))])
 return json.loads(json.dumps(ret, cls=DjangoJSONEncoder))

def serialize_instance ( instance ) : ret = dict ( [ ( k , v ) for ( k , v ) in instance . __dict__ . items ( ) if ( not k . startswith ( '_' ) ) ] ) return json . loads ( json . dumps ( ret , cls = DjangoJSONEncoder ) )
since django 1 .