'Either write the integer to
field_id
Or if its a real object
field_id = int
field = object'

def _set_object_or_id(self, field, object_):

    id_field = ('%s_id' % field)
    if isinstance(object_, six.integer_types):
        setattr(self, id_field, object_)
    elif (object_ is None):
        setattr(self, field, None)
        setattr(self, id_field, None)
    else:
        setattr(self, field, object_)
        setattr(self, id_field, object_.id)
