def test_model_pickle(self):
        original = Container.SomeModel(pk=1)
        dumped = pickle.dumps(original)
        reloaded = pickle.loads(dumped)
        self.assertEqual(original, reloaded)
        # Also, deferred dynamic model works
        Container.SomeModel.objects.create(somefield=1)
        original = Container.SomeModel.objects.defer('somefield')[0]
        dumped = pickle.dumps(original)
        reloaded = pickle.loads(dumped)
        self.assertEqual(original, reloaded)
        self.assertEqual(original.somefield, reloaded.somefield)
Test that a model not defined on module level is pickleable.
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/Django-1.6.10/tests/queryset_pickle/tests.py/PickleabilityTestCase.test_model_pickle