'Here we check if the default value is an object and return the to_field if so.'

def get_default(self):

    field_default = super(ForeignKey, self).get_default()
    if isinstance(field_default, self.rel.to):
        return getattr(field_default, self.related_field.attname)
    return field_default
