original_docstring: 
          Custom method to check that an id is provided for previous instance when
          corresponding plugin is of type 'ds'. Then check that the provided id exists in
          the DB and that the user can run plugins within this feed.
          
docstring: Custom method to check that an id is provided for previous instance when
  corresponding plugin is of type 'ds'. Then check that the provided id exists in
  the DB and that the user can run plugins within this feed.
docstring_tokens: Custom method to check that an id is provided for previous instance when corresponding plugin is of type ' ds ' . Then check that the provided id exists in the DB and that the user can run plugins within this feed .
code: def validate_previous(self, previous_id):
          """
          Custom method to check that an id is provided for previous instance when
          corresponding plugin is of type 'ds'. Then check that the provided id exists in
          the DB and that the user can run plugins within this feed.
          """
          # using self.context['view'] in validators prevents calling is_valid when creating
          # a new serializer instance outside the Django view framework. But here is fine
          # as plugin instances are always created through the API
          plugin = self.context['view'].get_object()
          previous = None
          if plugin.type=='ds':
              if not previous_id:
                  raise serializers.ValidationError(
                      {'previous_id': ["This field is required."]})
              try:
                  pk = int(previous_id)
                  previous = PluginInstance.objects.get(pk=pk)
              except (ValueError, ObjectDoesNotExist):
                  err_str = "Couldn't find any 'previous' plugin instance with id %s."
                  raise serializers.ValidationError(
                      {'previous_id': [err_str % previous_id]})
              # check that the user can run plugins within this feed
              user = self.context['request'].user
              if user not in previous.feed.owner.all():
                  err_str = "User is not an owner of feed for previous instance with id %s."
                  raise serializers.ValidationError(
                      {'previous_id': [err_str % previous_id]})
          return previous
code_tokens: def validate_previous ( self , previous_id ) : plugin = self . context [ 'view' ] . get_object ( ) previous = None if plugin . type == 'ds' : if not previous_id : raise serializers . ValidationError ( { 'previous_id' : [ "This field is required." ] } ) try : pk = int ( previous_id ) previous = PluginInstance . objects . get ( pk = pk ) except ( ValueError , ObjectDoesNotExist ) : err_str = "Couldn't find any 'previous' plugin instance with id %s." raise serializers . ValidationError ( { 'previous_id' : [ err_str % previous_id ] } ) user = self . context [ 'request' ] . user if user not in previous . feed . owner . all ( ) : err_str = "User is not an owner of feed for previous instance with id %s." raise serializers . ValidationError ( { 'previous_id' : [ err_str % previous_id ] } ) return previous
short_docstring: Custom method to check that an id is provided for previous instance when
  corresponding plugin is of type 'ds'.
short_docstring_tokens: Custom method to check that an id is provided for previous instance when corresponding plugin is of type ' ds ' .
comment: """
          Custom method to check that an id is provided for previous instance when
          corresponding plugin is of type 'ds'. Then check that the provided id exists in
          the DB and that the user can run plugins within this feed.
          """$SEP$# using self.context['view'] in validators prevents calling is_valid when creating$SEP$# a new serializer instance outside the Django view framework. But here is fine$SEP$# as plugin instances are always created through the API$SEP$# check that the user can run plugins within this feed