def goal_reached(self, x, y):
        if x >= self.track_width:
            # Reward for reaching the end
            return 100
        else:
            return self.ts
Here we check if the default value is an object and return the to_field if so.
dataset/ETHPy150Open dandxy89/rf_helicopter/Model/World.py/helicopter_world.goal_reached--crossover with--dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/Django-1.6.10/django/db/models/fields/related.py/ForeignKey.get_default