'Pickling support.'

def __getstate__(self):

    obj_dict = self.__dict__.copy()
    obj_dict['related_select_fields'] = []
    obj_dict['related_select_cols'] = []
    obj_dict['select_fields'] = [(((f is not None) and f.name) or None) for f in obj_dict['select_fields']]
    return obj_dict
