          if self.instance is not None:
              return queryset.exclude(pk=self.instance.pk)
          return queryset
  
      def __call__(self, attrs):
          self.enforce_required_fields(attrs)
          queryset = self.queryset
          queryset = self.filter_queryset(attrs, queryset)
          queryset = self.exclude_current_instance(attrs, queryset)
          if qs_exists(queryset):
 
</s> remove         queryset = self.filter_queryset(attrs, queryset)
        queryset = self.exclude_current_instance(attrs, queryset)
 </s> add         queryset = self.filter_queryset(attrs, queryset, field_name, date_field_name)
        queryset = self.exclude_current_instance(attrs, queryset, instance) </s> remove         if self.instance is not None:
            return queryset.exclude(pk=self.instance.pk)
 </s> add         if instance is not None:
            return queryset.exclude(pk=instance.pk) </s> remove     def __call__(self, value):
 </s> add     def __call__(self, value, serializer_field):
        # Determine the underlying model field name. This may not be the
        # same as the serializer field name if `source=<>` is set.
        field_name = serializer_field.source_attrs[-1]
        # Determine the existing instance, if this is an update operation.
        instance = getattr(serializer_field.parent, 'instance', None)
 </s> remove         queryset = self.filter_queryset(value, queryset)
        queryset = self.exclude_current_instance(queryset)
 </s> add         queryset = self.filter_queryset(value, queryset, field_name)
        queryset = self.exclude_current_instance(queryset, instance) </s> remove     def set_context(self, serializer_field):
        self.is_update = serializer_field.parent.instance is not None
        if callable(self.default) and hasattr(self.default, 'set_context') and not self.is_update:
            self.default.set_context(serializer_field)

    def __call__(self):
        if self.is_update:
 </s> add     def __call__(self, serializer_field):
        is_update = serializer_field.parent.instance is not None
        if is_update:
    def __call__(self, attrs, serializer):
        # Determine the underlying model field names. These may not be the
        # same as the serializer field names if `source=<>` is set.
        field_name = serializer.fields[self.field].source_attrs[-1]
        date_field_name = serializer.fields[self.date_field].source_attrs[-1]
        # Determine the existing instance, if this is an update operation.
        instance = getattr(serializer, 'instance', None)

          if self.instance is not None:
              return queryset.exclude(pk=self.instance.pk)
          return queryset
  
    def __call__(self, attrs, serializer):
        # Determine the underlying model field names. These may not be the
        # same as the serializer field names if `source=<>` is set.
        field_name = serializer.fields[self.field].source_attrs[-1]
        date_field_name = serializer.fields[self.date_field].source_attrs[-1]
        # Determine the existing instance, if this is an update operation.
        instance = getattr(serializer, 'instance', None)

          self.enforce_required_fields(attrs)
          queryset = self.queryset
          queryset = self.filter_queryset(attrs, queryset)
          queryset = self.exclude_current_instance(attrs, queryset)
          if qs_exists(queryset):
keep keep keep keep replace keep keep keep keep keep
 Drop `set_context()` (#7062)

* Do not persist the context in validators

Fixes encode/django-rest-framework#5760

* Drop set_context() in favour of 'requires_context = True' 
rest_framework/validators.py