def to_dict(klass, **kw):
        result = {klass.slug: []}

        for lab_test in LabTest.list():
            serialised = serialize_model(lab_test)
            if lab_test.RESULT_CHOICES:
                serialised["result_choices"] = {k: v for k, v, in lab_test.RESULT_CHOICES}
            result[klass.slug].append(serialised)
        return result
 def to_dict(klass):
     """
     Serialise referral routes for the client
     """
     return dict(name=klass.name,
                 description=klass.description,
                 slug=klass.slug(),
                 verb=klass.verb,
                 progressive_verb=klass.progressive_verb,
                 past_verb=klass.past_verb,
                 page_title=klass.page_title,
                 additional_models=[
                     serialize_model(m) for m in klass.additional_models
                 ])
 def to_dict(klass):
     """
     Serialise referral routes for the client
     """
     return dict(
         name=klass.name,
         description=klass.description,
         slug=klass.slug(),
         verb=klass.verb,
         progressive_verb=klass.progressive_verb,
         past_verb=klass.past_verb,
         page_title=klass.page_title,
         additional_models=[
             serialize_model(m) for m in klass.additional_models
         ]
     )
 def test_serialize_readonly(self):
     self.assertEqual(True, schemas.serialize_model(FamousLastWords)['readOnly'])
 def test_serialize_sort(self):
     self.assertEqual('name', schemas.serialize_model(HatWearer)['sort'])
 def test_serialize(self):
     self.assertEqual(colour_serialized, schemas.serialize_model(Colour))
Exemple #7
0
 def test_serialize_modal(self):
     self.assertEqual(
         'lg',
         schemas.serialize_model(FamousLastWords)['modal_size'])
 def test_serialize(self):
     self.assertEqual(colour_serialized, schemas.serialize_model(Colour))