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
5a86ba0c
Commit
5a86ba0c
authored
Nov 01, 2016
by
Miles Richardson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix issue #153
parent
b2bf2e27
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
7 deletions
+18
-7
parse_rest/datatypes.py
+4
-5
parse_rest/user.py
+14
-2
No files found.
parse_rest/datatypes.py
View file @
5a86ba0c
...
...
@@ -126,7 +126,7 @@ class EmbeddedObject(ParseType):
return
klass
(
**
kw
)
@complex_type
()
@complex_type
(
'Relation'
)
class
Relation
(
ParseType
):
@classmethod
def
from_native
(
cls
,
**
kw
):
...
...
@@ -178,10 +178,9 @@ class Relation(ParseType):
return
repr
def
_to_native
(
self
):
return
{
'__type'
:
'Relation'
,
'className'
:
self
.
relatedClassName
}
# Saving relations is a separate operation and thus should never need
# to convert this field _to_native
return
None
def
add
(
self
,
objs
):
"""Adds a Parse.Object or an array of Parse.Objects to the relation."""
...
...
parse_rest/user.py
View file @
5a86ba0c
...
...
@@ -118,7 +118,7 @@ class User(ParseResource):
def
__repr__
(
self
):
return
'<User:
%
s (Id
%
s)>'
%
(
getattr
(
self
,
'username'
,
None
),
self
.
objectId
)
def
removeRelation
(
self
,
key
,
className
,
objectsId
):
self
.
manageRelation
(
'RemoveRelation'
,
key
,
className
,
objectsId
)
...
...
@@ -139,7 +139,19 @@ class User(ParseResource):
}
}
self
.
__class__
.
PUT
(
self
.
_absolute_url
,
**
payload
)
self
.
__dict__
[
key
]
=
''
# Commented this line out to fix the saving relation issue --
# it's better to just return None in Relation._to_native
# self.__dict__[key] = ''
def
relation
(
self
,
key
):
if
not
hasattr
(
self
,
key
):
return
Relation
(
parentObject
=
self
,
key
=
key
)
try
:
return
getattr
(
self
,
key
)
.
with_parent
(
parentObject
=
self
,
key
=
key
)
except
:
raise
ParseError
(
"Column '
%
s' is not a Relation."
%
(
key
,))
User
.
Query
=
QueryManager
(
User
)
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