Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
ParsePy
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ParsePy
Commits
bcb8692b
Commit
bcb8692b
authored
Dec 21, 2015
by
johnk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Incorporated suggestions
Changed some comments. Rewrote part of the documentation.
parent
fa21c7df
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
7 deletions
+9
-7
README.mkd
+7
-5
parse_rest/datatypes.py
+2
-2
No files found.
README.mkd
View file @
bcb8692b
...
@@ -373,9 +373,12 @@ for post in posts_by_joe:
...
@@ -373,9 +373,12 @@ for post in posts_by_joe:
Relations
Relations
---------
---------
You can associate multiple objects to a single object
A Relation is field that contains references to multiple objects.
by using a Relation.
You can query this subset of objects.
You then query against this subset of objects.
For example, if we have Game and GameScore classes, and one game
can have multiple GameScores, you can use relations to associate
those GameScores with a Game.
~~~
~~ {python}
~~~
~~ {python}
game = Game(name="3-way Battle")
game = Game(name="3-way Battle")
...
@@ -388,7 +391,7 @@ relation.add([score1, score2, score3])
...
@@ -388,7 +391,7 @@ relation.add([score1, score2, score3])
~~~
~~
~~~
~~
A Game gets added, three GameScores get added, and three relations
A Game gets added, three GameScores get added, and three relations
are created associating the
scores with the g
ame.
are created associating the
GameScores with the G
ame.
To retreive the related scores for a game, you use query() to get a
To retreive the related scores for a game, you use query() to get a
Queryset for the relation.
Queryset for the relation.
...
@@ -399,7 +402,6 @@ for gamescore in scores:
...
@@ -399,7 +402,6 @@ for gamescore in scores:
print gamescore.player_name, gamescore.score
print gamescore.player_name, gamescore.score
~~~
~~
~~~
~~
The Queryset can be manipulated like any Queryset.
The query is limited to the objects previously added to the
The query is limited to the objects previously added to the
relation.
relation.
...
...
parse_rest/datatypes.py
View file @
bcb8692b
...
@@ -145,12 +145,12 @@ class Relation(ParseType):
...
@@ -145,12 +145,12 @@ class Relation(ParseType):
queries until we know what classes are on both sides
queries until we know what classes are on both sides
of the relation.
of the relation.
If it's called via from_native, then
,
a later call to
If it's called via from_native, then a later call to
with_parent() provides parent information.
with_parent() provides parent information.
If it's called as Relation(), the relatedClassName is
If it's called as Relation(), the relatedClassName is
discovered either on the first added object, or
discovered either on the first added object, or
by
probing the server to retrieve an object
.
by
querying the server to retrieve the schema
.
"""
"""
# Name of the key on the parent object.
# Name of the key on the parent object.
self
.
key
=
None
self
.
key
=
None
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment