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
a66533a2
Commit
a66533a2
authored
Jun 05, 2015
by
Dan Krause
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #115 from felipe-lavratti/remove_field
Added Remove Field support on Object, including tests
parents
70d5343c
4c4b9fe7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
0 deletions
+19
-0
parse_rest/datatypes.py
+13
-0
parse_rest/tests.py
+6
-0
No files found.
parse_rest/datatypes.py
View file @
a66533a2
...
@@ -455,6 +455,19 @@ class Object(six.with_metaclass(ObjectMetaclass, ParseResource)):
...
@@ -455,6 +455,19 @@ class Object(six.with_metaclass(ObjectMetaclass, ParseResource)):
}
}
self
.
__class__
.
PUT
(
self
.
_absolute_url
,
**
payload
)
self
.
__class__
.
PUT
(
self
.
_absolute_url
,
**
payload
)
self
.
__dict__
[
key
]
+=
amount
self
.
__dict__
[
key
]
+=
amount
def
remove
(
self
,
key
):
"""
Clear a column value in the object. Note that this happens immediately:
it does not wait for save() to be called.
"""
payload
=
{
key
:
{
'__op'
:
'Delete'
}
}
self
.
__class__
.
PUT
(
self
.
_absolute_url
,
**
payload
)
del
self
.
__dict__
[
key
]
def
removeRelation
(
self
,
key
,
className
,
objectsId
):
def
removeRelation
(
self
,
key
,
className
,
objectsId
):
self
.
manageRelation
(
'RemoveRelation'
,
key
,
className
,
objectsId
)
self
.
manageRelation
(
'RemoveRelation'
,
key
,
className
,
objectsId
)
...
...
parse_rest/tests.py
View file @
a66533a2
...
@@ -143,6 +143,12 @@ class TestObject(unittest.TestCase):
...
@@ -143,6 +143,12 @@ class TestObject(unittest.TestCase):
self
.
score
.
increment
(
'score'
)
self
.
score
.
increment
(
'score'
)
self
.
assertTrue
(
GameScore
.
Query
.
filter
(
score
=
previous_score
+
1
)
.
exists
(),
self
.
assertTrue
(
GameScore
.
Query
.
filter
(
score
=
previous_score
+
1
)
.
exists
(),
'Failed to increment score on backend'
)
'Failed to increment score on backend'
)
def
testCanRemoveField
(
self
):
self
.
score
.
save
()
self
.
score
.
remove
(
'score'
)
self
.
assertTrue
(
GameScore
.
Query
.
filter
(
score
=
None
)
.
exists
(),
'Failed to remove score on backend'
)
def
testAssociatedObject
(
self
):
def
testAssociatedObject
(
self
):
"""test saving and associating a different object"""
"""test saving and associating a different object"""
...
...
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