Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fields will not read what it writes #60

Closed
wants to merge 4 commits into from

Commits on May 29, 2015

  1. Fields will not read what it writes

    When to_representation is run on a geo object json.load adds unicode strings so the result is something like:
    
    ```
    {u'type': u'Point', u'coordinates': [39.921092168090915, 28.04062843322754]}
    ```
    
    this is the string that rest_framework puts into the web form for any PUTs to edit the field. Therefore the PUT will send the string:
    
    ```
    "{u'type': u'Point', u'coordinates': [39.921092168090915, 28.04062843322754]}"
    ```
    
    which will not work with GEOSGeometry as it does not expect the u symbols. The way around this is to eval the string as a python dictionary and then dump the json. This creates the string:
    
    ```
    '{"type": "Point", "coordinates": [39.921092168090915, 28.04062843322754]}'
    ```
    
    which will then work.
    nparley committed May 29, 2015
    Configuration menu
    Copy the full SHA
    3ad8048 View commit details
    Browse the repository at this point in the history
  2. Update fields.py

    Return dictionary with correct json __str__ value
    nparley committed May 29, 2015
    Configuration menu
    Copy the full SHA
    114c734 View commit details
    Browse the repository at this point in the history

Commits on May 30, 2015

  1. Update fields.py

    Only update the __str__ of the returned dict
    nparley committed May 30, 2015
    Configuration menu
    Copy the full SHA
    c02092a View commit details
    Browse the repository at this point in the history
  2. Update fields.py

    nparley committed May 30, 2015
    Configuration menu
    Copy the full SHA
    0227517 View commit details
    Browse the repository at this point in the history