title: Field Serializers Django
body: <p>I have a serializer with some custom fields and those fields depends on a specific query. The problem is that each time the serializer tries to get the value for this field It must perform the query to the DB. What about if the serializer is a many=True serializer?.</p>
  <pre><code>class ExampleSerializer(serializers.ModelSerializer):
  
    field_one = serializers.SerializerMethodField()
    field_two = serializers.SerializerMethodField()
    field_three = serializers.SerializerMethodField()
    .
    .
    .
  
    def get_field_one(self, obj):
      try:
        # This is where i do the query
        query_result = obj.objects.filter(filter=self.context.get(&quot;filter&quot;).first()
        if query_result:
          # Do field one stuff
      except Exception:
        # Do exception stuff
  
    def get_field_two(self, obj):
      try:
       # This is where i do the query
       query_result = obj.objects.filter(filter=self.context.get(&quot;filter&quot;).first()
       if query_result:
          # Do field two stuff
      except Exception:
        # Do exception stuff
  
    def get_field_three(self, obj):
      try:
       # This is where i do the query
       query_result = obj.objects.filter(filter=self.context.get(&quot;filter&quot;).first()
       if query_result:
          # Do field three stuff
      except Exception:
        # Do exception stuff
  </code></pre>
  <p>Is there a way to store that result inside a property in the serializer?
  Also, if I set a value in one of the serializer field, how do I retrieve and do some maths on another field in the same serializer?</p>