Can't seem to find the right google search for this so here it goes:
I have a field in my serializer:
likescount = serializers.IntegerField(source='post.count', read_only=True)
which counts all the related field "post".
Now I want to use that field as part of my method:
def popularity(self, obj):
like = self.likescount
time = datetime.datetime.now()
return like/time
Is this possible?
question from:https://stackoverflow.com/questions/24233988/django-serializer-method-field