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
e6785eab
Commit
e6785eab
authored
Apr 09, 2014
by
David Robinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #30 from rbermudezg/RelationalSupport
Add, Remove, and query Relations
parents
870dd6fa
3ace526b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
1 deletions
+27
-1
parse_rest/datatypes.py
+23
-0
parse_rest/query.py
+4
-1
No files found.
parse_rest/datatypes.py
View file @
e6785eab
...
@@ -367,3 +367,25 @@ class Object(ParseResource):
...
@@ -367,3 +367,25 @@ class Object(ParseResource):
}
}
self
.
__class__
.
PUT
(
self
.
_absolute_url
,
**
payload
)
self
.
__class__
.
PUT
(
self
.
_absolute_url
,
**
payload
)
self
.
__dict__
[
key
]
+=
amount
self
.
__dict__
[
key
]
+=
amount
def
removeRelation
(
self
,
key
,
className
,
objectsId
):
self
.
manageRelation
(
'RemoveRelation'
,
key
,
className
,
objectsId
)
def
addRelation
(
self
,
key
,
className
,
objectsId
):
self
.
manageRelation
(
'AddRelation'
,
key
,
className
,
objectsId
)
def
manageRelation
(
self
,
action
,
key
,
className
,
objectsId
):
objects
=
[{
"__type"
:
"Pointer"
,
"className"
:
className
,
"objectId"
:
objectId
}
for
objectId
in
objectsId
]
payload
=
{
key
:
{
"__op"
:
action
,
"objects"
:
objects
}
}
self
.
__class__
.
PUT
(
self
.
_absolute_url
,
**
payload
)
self
.
__dict__
[
key
]
=
''
\ No newline at end of file
parse_rest/query.py
View file @
e6785eab
...
@@ -77,7 +77,7 @@ class Queryset(object):
...
@@ -77,7 +77,7 @@ class Queryset(object):
__metaclass__
=
QuerysetMetaclass
__metaclass__
=
QuerysetMetaclass
OPERATORS
=
[
OPERATORS
=
[
'lt'
,
'lte'
,
'gt'
,
'gte'
,
'ne'
,
'in'
,
'nin'
,
'exists'
,
'select'
,
'dontSelect'
,
'all'
'lt'
,
'lte'
,
'gt'
,
'gte'
,
'ne'
,
'in'
,
'nin'
,
'exists'
,
'select'
,
'dontSelect'
,
'all'
,
'relatedTo'
]
]
@staticmethod
@staticmethod
...
@@ -123,6 +123,9 @@ class Queryset(object):
...
@@ -123,6 +123,9 @@ class Queryset(object):
if
operator
is
None
:
if
operator
is
None
:
self
.
_where
[
attr
]
=
parse_value
self
.
_where
[
attr
]
=
parse_value
else
:
else
:
if
operator
==
'relatedTo'
:
self
.
_where
[
'$'
+
operator
]
=
parse_value
else
:
self
.
_where
[
attr
][
'$'
+
operator
]
=
parse_value
self
.
_where
[
attr
][
'$'
+
operator
]
=
parse_value
return
self
return
self
...
...
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