                  else:
                      response = Response(status.HTTP_204_NO_CONTENT)
      
                  # Pre-serialize filtering (eg filter complex objects into natively serializable types)
                  response.cleaned_content = self.resource.object_to_serializable(response.raw_content)
          
              except ErrorResponse, exc:
                  response = exc.response
              except:
                  import traceback
 
</s> remove     def cleanup_response(self, data):
        """Perform any resource-specific data filtering prior to the standard HTTP
        content-type serialization.

        Eg filter complex objects that cannot be serialized by json/xml/etc into basic objects that can.
        
        TODO: This is going to be removed.  I think that the 'fields' behaviour is going to move into
        the RendererMixin and Renderer classes."""
        return data


 </s> add  </s> remove # TODO: Replace this with new Serializer code based on Forms API.
 </s> add def _form_to_data(form):
    """
    Returns a dict containing the data in a form instance.
    
    This code is pretty much a clone of the ``Form.as_p()`` ``Form.as_ul``
    and ``Form.as_table()`` methods, except that it returns data suitable
    for arbitrary serialization, rather than rendering the result directly
    into html.
    """
    ret = {}
    for name, field in form.fields.items():
        if not form.is_bound:
            data = form.initial.get(name, field.initial)
            if callable(data):
                data = data()
        else:
            if isinstance(field, FileField) and form.data is None:
                data = form.initial.get(name, field.initial)
            else:
                data = field.widget.value_from_datadict(form.data, form.files, name)
        ret[name] = field.prepare_value(data)
    return ret </s> remove class BaseView(RequestMixin, ResponseMixin, AuthMixin, View):
 </s> add class BaseView(ResourceMixin, RequestMixin, ResponseMixin, AuthMixin, View): </s> remove     # TODO: Acutally this needs to go into Resource
    def validate(self, content):
        """
        Validate, cleanup, and type-ify the request content.
        """
        for validator_cls in self.validators:
            validator = validator_cls(self)
            content = validator.validate(content)
        return content


    # TODO: Acutally this needs to go into Resource
    def get_bound_form(self, content=None):
        """
        Return a bound form instance for the given content,
        if there is an appropriate form validator attached to the view.
        """
        for validator_cls in self.validators:
            if hasattr(validator_cls, 'get_bound_form'):
                validator = validator_cls(self)
                return validator.get_bound_form(content)
        return None


 </s> add 
                response.cleaned_content = self.object_to_data(response.raw_content)
                  else:
                      response = Response(status.HTTP_204_NO_CONTENT)
      
                  # Pre-serialize filtering (eg filter complex objects into natively serializable types)
                response.cleaned_content = self.object_to_data(response.raw_content)
          
              except ErrorResponse, exc:
                  response = exc.response
              except:
                  import traceback
keep keep keep keep replace keep keep keep keep keep
 refactoring resource specfic stuff into ResourceMixin - validators now defunct 
djangorestframework/views.py