Пример #1
0
 def test_exclude_keys(self):
     exclude_keys = ['one']
     key_values = {'one': 1, 'two': 2}
     new_keys = utils.exclude(key_values, *exclude_keys)
     self.assertEqual(len(new_keys), 1)
     self.assertEqual(new_keys, {'two': 2})
Пример #2
0
 def _extract_required_params(self, params, model_name):
     params = params or {}
     model_params = params.get(model_name, {})
     return utils.stringify_keys(utils.exclude(model_params,
                                               *self.exclude_attr))
Пример #3
0
 def test_empty_exclude(self):
     self.assertEqual(utils.exclude(None), None)
Пример #4
0
 def _extract_required_params(self, params, model_name):
     params = params or {}
     model_params = params.get(model_name, {})
     return utils.stringify_keys(utils.exclude(model_params,
                                               *self.exclude_attr))
Пример #5
0
 def test_exclude_keys(self):
     exclude_keys = ['one']
     key_values = {'one': 1, 'two': 2 }
     new_keys = utils.exclude(key_values, *exclude_keys)
     self.assertEqual(len(new_keys), 1)
     self.assertEqual(new_keys, {'two': 2 })
Пример #6
0
 def test_empty_exclude(self):
     self.assertEqual(utils.exclude(None), None)
Пример #7
0
    def update(self, **values):
        attrs = utils.exclude(values, *self._auto_generated_attrs)
        self.merge_attributes(attrs)
        result = self.save()
#        self._notify_fields("update")
        return result