[1.6.x] Fixed #22486 -- Restored the ability to reverse views created using functools.partial.

Regression in 8b93b31487d6d3b0fcbbd0498991ea0db9088054.

Thanks rcoup for the report.

Backport of 3c06b2f2a3 from master
Removed bad import in last commit.