          else:
              raise ValidationError(self.error_messages['configuration_error'])
  
          try:
              obj = queryset.get()
          except ObjectDoesNotExist:
              raise ValidationError(self.error_messages['does_not_exist'])
          except (TypeError, ValueError):
              msg = self.error_messages['incorrect_type']
              raise ValidationError(msg % type(value).__name__)
  
 
</s> remove         except (TypeError, ValueError):
            msg = self.error_messages['incorrect_type']
            raise ValidationError(msg % type(value).__name__)

        return obj
 </s> add  </s> remove         pk = match.kwargs.get(self.pk_url_kwarg, None)
        slug = match.kwargs.get(self.slug_url_kwarg, None)

        # Try explicit primary key.
        if pk is not None:
            queryset = self.queryset.filter(pk=pk)
        # Next, try looking up by slug.
        elif slug is not None:
            slug_field = self.get_slug_field()
            queryset = self.queryset.filter(**{slug_field: slug})
        # If none of those are defined, it's probably a configuation error.
        else:
            raise ValidationError(self.error_messages['configuration_error'])

 </s> add  </s> remove         if not slug:
            raise Exception('Could not resolve URL for field using view name "%s"' % view_name)
 </s> add         raise NoReverseMatch() </s> remove             pass

        raise Exception('Could not resolve URL for field using view name "%s"' % view_name)
 </s> add             msg = (
                'Could not resolve URL for hyperlinked relationship using '
                'view name "%s". You may have failed to include the related '
                'model in your API, or incorrectly configured the '
                '`lookup_field` attribute on this field.'
            )
            raise Exception(msg % view_name) </s> remove             return reverse(view_name, kwargs=kwargs, request=request, format=format)
 </s> add             return self.get_url(obj, view_name, request, format)
            return self.get_object(queryset, match.view_name,
                                   match.args, match.kwargs)
        except (ObjectDoesNotExist, TypeError, ValueError):
          else:
              raise ValidationError(self.error_messages['configuration_error'])
  
          try:
            return self.get_object(queryset, match.view_name,
                                   match.args, match.kwargs)
        except (ObjectDoesNotExist, TypeError, ValueError):
            return self.get_object(queryset, match.view_name,
                                   match.args, match.kwargs)
        except (ObjectDoesNotExist, TypeError, ValueError):
              raise ValidationError(self.error_messages['does_not_exist'])
          except (TypeError, ValueError):
              msg = self.error_messages['incorrect_type']
              raise ValidationError(msg % type(value).__name__)
  
keep keep keep keep replace replace keep keep keep keep keep
 lookup_field on hyperlinked fields, and overriddable hyperlinked fields.  Closes #688 
rest_framework/relations.py