How to pass one MethodField data to another MethodFiels in django

I have a SerializerMethod field like below

cal = models.SerializerMethodField('__getcal__')
def __getcal__(self, obj):
  return obj*20

Now i want those data to be passed in another SerializerMethod and do some other calculation.

something like this

cal2 = models.SerializerMethodField('__getcaltwo__')

def __getcaltwo__(self, obj):
  x = self.__getcal__(obj)
  return x*100

how can i achive this?

Back to Top