'Coerce {pk} path arguments into the name of the model field,
where possible. This is cleaner for an external representation.
(Ie. "this is an identifier", not "this is a database primary key")'

def coerce_path(self, path, method, view):

    if ((not self.coerce_path_pk) or ('{pk}' not in path)):
        return path
    model = getattr(getattr(view, 'queryset', None), 'model', None)
    if model:
        field_name = get_pk_name(model)
    else:
        field_name = 'id'
    return path.replace('{pk}', ('{%s}' % field_name))
