Commits

Matthew Schinckel committed 5617d6b

Add in the ability to have methods on ModelApi used to calculate values.

  • Participants
  • Parent commits 070954f

Comments (0)

Files changed (1)

File rest_api/serializers.py

             for field in fields:
                 try:
                     temp = getattr(obj, field, None)
+                    if api_model:
+                        if getattr(api_model, field, None):
+                            temp = getattr(api_model, field)(obj)
                 except ObjectDoesNotExist:
                     temp = None
                 if api_model and field in api_model.embed_objects: