Exemple #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})
Exemple #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))
Exemple #3
0
 def test_empty_exclude(self):
     self.assertEqual(utils.exclude(None), None)
Exemple #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))
Exemple #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 })
Exemple #6
0
 def test_empty_exclude(self):
     self.assertEqual(utils.exclude(None), None)
Exemple #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