def form_validation_response(self, e):
- Method to return form validation error information.
+ Method to return form validation error information.
You will probably want to override this in your own
+ # Allow for emulated PUT requests -- http://backbonejs.org/#Sync-emulateHTTP
+ if 'HTTP_X_HTTP_METHOD_OVERRIDE' in request.META:
+ rm = request.META.get('HTTP_X_HTTP_METHOD_OVERRIDE')
+ request.PUT = request.POST
# Translate nested datastructs into `request.data` here.
if rm in ('POST', 'PUT'):
# If we're looking at a response object which contains non-string
- # content, then assume we should use the emitter to format that
+ # content, then assume we should use the emitter to format that
if isinstance(result, HttpResponse) and not result._is_string:
status_code = result.status_code
# Note: We can't use result.content here because that method attempts
- # to convert the content into a string which we don't want.
+ # to convert the content into a string which we don't want.
# when _is_string is False _container is the raw data
result = result._container
srl = emitter(result, typemapper, handler, fields, anonymous)
def error_handler(self, e, request, meth, em_format):
- Override this method to add handling of errors customized for your
+ Override this method to add handling of errors customized for your
if isinstance(e, FormValidationError):
elif isinstance(e, HttpStatusCode):
On errors (like code errors), we'd like to be able to
give crash reports to both admins and also the calling