Opened 9 years ago
Closed 9 years ago
#26884 closed Bug (fixed)
update_or_create does not evaluate callables in defaults for update case
Description ¶
Ticket #26638 added support for accepting callables in the 'defaults' parameter of get_or_create and update_or_create. In the case where update_or_create is updating, the callables are not evaluated. I have written a test for update_or_create that demonstrates this behavior (attached).
Here is the traceback for that test failure:
====================================================================== FAIL: test_update_callable_default (get_or_create.tests.UpdateOrCreateTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/lib64/python2.7/unittest/case.py", line 369, in run testMethod() File "/home/default/sandbox/django/tests/get_or_create/tests.py", line 423, in test_update_callable_default self.assertEqual(obj.last_name, 'NotHarrison') File "/usr/lib64/python2.7/unittest/case.py", line 553, in assertEqual assertion_func(first, second, msg=msg) File "/usr/lib64/python2.7/unittest/case.py", line 546, in _baseAssertEqual raise self.failureException(msg) AssertionError: <function <lambda> at 0x22d0320> != u'NotHarrison' ----------------------------------------------------------------------
Change History (6)
comment:1 by , 9 years ago
Type: | Uncategorized → Bug |
---|
by , 9 years ago
Attachment: | 26884.diff added |
---|
comment:2 by , 9 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:3 by , 9 years ago
Has patch: | set |
---|---|
Owner: | changed from | to
Status: | new → assigned |
comment:4 by , 9 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
Note:
See TracTickets
for help on using tickets.
PR