Пример #1
0
def get_attribute(obj, field_name):
    data = model_to_dict(obj, fields=[field_name])
    return get_value(type(obj), data, field_name)
Пример #2
0
 def test_get_value_for_enum(self):
     data = self.learning_unit_year.__dict__
     self.assertEqual(get_value(LearningUnitYear, data, 'subtype'), 'FULL')
Пример #3
0
 def test_get_value(self):
     data = self.learning_unit_year.__dict__
     self.assertEqual(get_value(LearningUnitYear, data, 'specific_title'),
                      TITLE)
Пример #4
0
 def test_get_value_for_boolean(self):
     data = self.learning_unit_year.__dict__
     self.assertEqual(get_value(LearningUnitYear, data, 'status'), 'Actif')