Fixed #21853 -- Fixed Manager.__module__ to properly return 'django.db.models.manager'.
The combination of BaseManager.from_queryset() and RenameMethodsBase results in Manager.__module__ having the wrong value. This can be an issue when trying to pickle the Manager class.
This commit is contained in:
parent
88a2d39159
commit
3e4dc5ecf2
|
@ -190,7 +190,9 @@ class BaseManager(six.with_metaclass(RenameManagerMethods)):
|
|||
# understanding of how this comes into play.
|
||||
return self.get_queryset()
|
||||
|
||||
Manager = BaseManager.from_queryset(QuerySet, class_name='Manager')
|
||||
|
||||
class Manager(BaseManager.from_queryset(QuerySet)):
|
||||
pass
|
||||
|
||||
|
||||
class ManagerDescriptor(object):
|
||||
|
|
|
@ -50,6 +50,9 @@ class PickleabilityTestCase(TestCase):
|
|||
self.assertEqual(original.__class__, unpickled.__class__)
|
||||
self.assertEqual(original.args, unpickled.args)
|
||||
|
||||
def test_manager_pickle(self):
|
||||
pickle.loads(pickle.dumps(Happening.objects))
|
||||
|
||||
def test_model_pickle(self):
|
||||
"""
|
||||
Test that a model not defined on module level is pickleable.
|
||||
|
|
Loading…
Reference in New Issue