@@ -17,13 +17,13 @@ Let's get everything set up first. You'll need to give **ParsePy** your _Applica
...
@@ -17,13 +17,13 @@ Let's get everything set up first. You'll need to give **ParsePy** your _Applica
To create a new object of the Parse class _GameScore_:
To create a new object of the Parse class _GameScore_:
~~~~~ {python}
~~~~~ {python}
>>> gameScore = parse.ParseObject("GameScore")
>>> gameScore = parse.Object("GameScore")
>>> gameScore.score = 1337
>>> gameScore.score = 1337
>>> gameScore.playerName = "Sean Plott"
>>> gameScore.playerName = "Sean Plott"
>>> gameScore.cheatMode = False
>>> gameScore.cheatMode = False
~~~~~
~~~~~
As you can see, we add new properties simply by assigning values to our _ParseObject_'s attributes. Supported data types are any type that can be serialized by JSON and Python's _datetime.datetime_ object. (Binary data and references to other _ParseObject_'s are also supported, as we'll see in a minute.)
As you can see, we add new properties simply by assigning values to our _Object_'s attributes. Supported data types are any type that can be serialized by JSON and Python's _datetime.datetime_ object. (Binary data and references to other _Object_'s are also supported, as we'll see in a minute.)
To save our new object, just call the save() method:
To save our new object, just call the save() method:
...
@@ -55,7 +55,7 @@ That's it! You're ready to start saving data on Parse.
...
@@ -55,7 +55,7 @@ That's it! You're ready to start saving data on Parse.
Object Metadata
Object Metadata
---------------
---------------
The methods objectId(), createdAt(), and updatedAt() return metadata about a _ParseObject_ that cannot be modified through the API:
The methods objectId(), createdAt(), and updatedAt() return metadata about a _Object_ that cannot be modified through the API:
If we want to store data in a ParseObject, we should wrap it in a ParseBinaryDataWrapper. The ParseBinaryDataWrapper behaves just like a string, and inherits all of _str_'s methods.
If we want to store data in a Object, we should wrap it in a ParseBinaryDataWrapper. The ParseBinaryDataWrapper behaves just like a string, and inherits all of _str_'s methods.
>>> collectedItem.save() # we have to save it before it can be referenced
>>> collectedItem.save() # we have to save it before it can be referenced
...
@@ -89,7 +89,7 @@ We can store a reference to another ParseObject by assigning it to an attribute:
...
@@ -89,7 +89,7 @@ We can store a reference to another ParseObject by assigning it to an attribute:
We can also store geoPoint dataTypes as attributes using the format <code>'POINT(longitude latitude)'</code>, with latitude and longitude as float values
We can also store geoPoint dataTypes as attributes using the format <code>'POINT(longitude latitude)'</code>, with latitude and longitude as float values
~~~~~ {python}
~~~~~ {python}
>>> restaurant = parse.ParseObject("Restaurant")
>>> restaurant = parse.Object("Restaurant")
>>> restaurant.name = "Los Pollos Hermanos"
>>> restaurant.name = "Los Pollos Hermanos"
>>> restaurant.location ="POINT(12.0 -34.45)"
>>> restaurant.location ="POINT(12.0 -34.45)"
>>> restaurant.save()
>>> restaurant.save()
...
@@ -102,13 +102,13 @@ Querying
...
@@ -102,13 +102,13 @@ Querying
To retrieve an object with a Parse class of _GameScore_ and an _objectId_ of _xxwXx9eOec_, run:
To retrieve an object with a Parse class of _GameScore_ and an _objectId_ of _xxwXx9eOec_, run:
We can also run more complex queries to retrieve a range of objects. For example, if we want to get a list of _GameScore_ objects with scores between 1000 and 2000 ordered by _playerName_, we would call:
We can also run more complex queries to retrieve a range of objects. For example, if we want to get a list of _GameScore_ objects with scores between 1000 and 2000 ordered by _playerName_, we would call: