tomchristie/django-rest-framework — pull request #883 by brianz (2013-05-24 03:09:53+00:00)
Title: Allow overriding of HyperlinkedIdentityField.lookup_field value.

Add the ability to get a HyperlinkedIdentityField value from a method call rather than a straight attribute lookup. This allows subclasses to transform the value returned as needed.

I made this change to solve a real use case which I'm hitting now. Fields returned are straight-up primary keys, but those keys are not returned verbatim to the client. Instead, what I need to return in a hyperlinked field is `primarykey * MULTIPLIER`. This change allows me to create a HyperlinkedIdentityField subclass and override the method.

All tests pass and new tests were added to cover this use case.