djangopython-3.xmongoenginerestframeworkmongoengine

Django Mongoengine leading whitespace being stripped


I have a small issue that I'm struggling to find a solution on.

Currently when I receive the result from a POST with JSON data back from Django(1.11.5), all leading whitespaces in some of the values are completely gone but all in between the words saved.

Is there a setting for MongoEngine that stops this on StringFields?

For example: I send with requests in Python(3.6.2):

{'foo': '  bar'}

I get back from the request content:

{'foo': 'bar'}

I'm using MongoEngine (0.14.3), django-restframwork-mongoengine (3.3.1) and viewsets.ModelViewSet btw :)


Solution

  • Found that I had a .strip() on the string. made this into .rstrip() and all presented well. :)