              request.POST.get(self.FORM_PARAM_CONTENT, None) is not None):
  
              # Set content type if form contains a none empty FORM_PARAM_CONTENTTYPE field
              content_type = None
              if self.FORM_PARAM_CONTENTTYPE and request.POST.get(self.FORM_PARAM_CONTENTTYPE, None):
                  content_type = request.POST.get(self.FORM_PARAM_CONTENTTYPE, None)
  
              return (content_type, request.POST[self.FORM_PARAM_CONTENT])
  
          return (content_type, request.raw_post_data) 
</s> remove         if (request.method == 'POST' and self.FORM_PARAM_CONTENT and
            request.POST.get(self.FORM_PARAM_CONTENT, None) is not None):
 </s> add         if (request.method == 'POST' and self.CONTENT_PARAM and
            request.POST.get(self.CONTENT_PARAM, None) is not None): </s> remove             return (content_type, request.POST[self.FORM_PARAM_CONTENT])
 </s> add             return (content_type, request.POST[self.CONTENT_PARAM]) </s> remove     FORM_PARAM_CONTENTTYPE = '_contenttype'
 </s> add     CONTENTTYPE_PARAM = '_contenttype' </s> remove     def determine_parser(self, request):
        """Return the appropriate parser for the input, given the client's 'Content-Type' header,
        and the content types that this Resource knows how to parse."""
        content_type = request.META.get('CONTENT_TYPE', 'application/x-www-form-urlencoded')
        raw_content = request.raw_post_data
    
        split = content_type.split(';', 1)
        if len(split) > 1:
            content_type = split[0]
        content_type = content_type.strip()
        
        # If CONTENTTYPE_PARAM is turned on, and this is a standard POST form then allow the content type to be overridden
        if (content_type == 'application/x-www-form-urlencoded' and
            request.method == 'POST' and
            self.CONTENTTYPE_PARAM and
            self.CONTENT_PARAM and
            request.POST.get(self.CONTENTTYPE_PARAM, None) and
            request.POST.get(self.CONTENT_PARAM, None)):
            raw_content = request.POST[self.CONTENT_PARAM]
            content_type = request.POST[self.CONTENTTYPE_PARAM]

        # Create a list of list of (media_type, Parser) tuples
        media_type_to_parser = dict([(parser.media_type, parser) for parser in self.parsers])

        try:
            return (media_type_to_parser[content_type], raw_content)
        except KeyError:
            raise ResponseException(status.HTTP_415_UNSUPPORTED_MEDIA_TYPE,
                                    {'detail': 'Unsupported media type \'%s\'' % content_type})


 </s> add  </s> remove     def get_form(self, data=None):
        """Optionally return a Django Form instance, which may be used for validation
        and/or rendered by an HTML/XHTML emitter.
        
        If data is not None the form will be bound to data."""

        if self.form:
            if data:
                return self.form(data)
            else:
                return self.form()
        return None
  
  
    def cleanup_request(self, data, form_instance):
        """Perform any resource-specific data deserialization and/or validation
        after the initial HTTP content-type deserialization has taken place.
        
        Returns a tuple containing the cleaned up data, and optionally a form bound to that data.
        
        By default this uses form validation to filter the basic input into the required types."""

        if form_instance is None:
            return data
        
        # Default form validation does not check for additional invalid fields
        non_existent_fields = []
        for key in set(data.keys()) - set(form_instance.fields.keys()):
            non_existent_fields.append(key)

        if not form_instance.is_valid() or non_existent_fields:
            if not form_instance.errors and not non_existent_fields:
                # If no data was supplied the errors property will be None
                details = 'No content was supplied'
                
            else:
                # Add standard field errors
                details = dict((key, map(unicode, val)) for (key, val) in form_instance.errors.iteritems() if key != '__all__')

                # Add any non-field errors
                if form_instance.non_field_errors():
                    details['errors'] = form_instance.non_field_errors()

                # Add any non-existent field errors
                for key in non_existent_fields:
                    details[key] = ['This field does not exist']

            # Bail.  Note that we will still serialize this response with the appropriate content type 
            raise ResponseException(status.HTTP_400_BAD_REQUEST, {'detail': details})

        return form_instance.cleaned_data

 </s> add 
            if self.CONTENTTYPE_PARAM and request.POST.get(self.CONTENTTYPE_PARAM, None):
                content_type = request.POST.get(self.CONTENTTYPE_PARAM, None)
              request.POST.get(self.FORM_PARAM_CONTENT, None) is not None):
  
              # Set content type if form contains a none empty FORM_PARAM_CONTENTTYPE field
              content_type = None
            if self.CONTENTTYPE_PARAM and request.POST.get(self.CONTENTTYPE_PARAM, None):
                content_type = request.POST.get(self.CONTENTTYPE_PARAM, None)
            if self.CONTENTTYPE_PARAM and request.POST.get(self.CONTENTTYPE_PARAM, None):
                content_type = request.POST.get(self.CONTENTTYPE_PARAM, None)
  
              return (content_type, request.POST[self.FORM_PARAM_CONTENT])
  
          return (content_type, request.raw_post_data) 
keep keep keep keep replace replace keep keep keep keep
 Refactor a bunch of stuff into mixins, more tests 
djangorestframework/content.py