def get_url(self, obj, view_name, request, response_format):
    lookup_value = getattr(obj, self.lookup_field)
    if self.url_kwarg:
        kwargs = {self.url_kwarg: lookup_value}
        return reverse(view_name, kwargs=kwargs, request=request, format=response_format)
    url = reverse(view_name, request=request, format=response_format)
    query_kwargs = {self.query_kwarg: lookup_value}
    return (u'%s?%s' % (url, urlencode(query_kwargs)))
def get_url(self, obj, view_name, request, response_format):
    lookup_value = getattr(obj, self.lookup_field)
    if self.url_kwarg:
        kwargs = {self.url_kwarg: lookup_value}
        return reverse(view_name, kwargs=kwargs, request=request, format=response_format)
    url = reverse(view_name, request=request, format=response_format)
    query_kwargs = {self.query_kwarg: lookup_value}
    return (u'%s?%s' % (url, urlencode(query_kwargs)))