'Test that a model not defined on module level is pickleable.'

def test_model_pickle(self):

    original = Container.SomeModel(pk=1)
    dumped = pickle.dumps(original)
    reloaded = pickle.loads(dumped)
    self.assertEqual(original, reloaded)
    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)
