def __init__(self, serializer_source, *args, **kwargs):
        """
        Arguments:
            serializer_source: A serializer field.
            unique: Whether or not to perform a count of distinct elements.
        """
        self.field_type = int
        # Use `serializer_source`, which indicates a field at the API level,
        # instead of `source`, which indicates a field at the model level.
        self.serializer_source = serializer_source
        # Set `source` to an empty value rather than the field name to avoid
        # an attempt to look up this field.
        kwargs['source'] = ''
        self.unique = kwargs.pop('unique', True)
        return super(CountField, self).__init__(*args, **kwargs)
def __init__ ( self , serializer_source , * args , ** kwargs ) : self . field_type = int self . serializer_source = serializer_source kwargs [ 'source' ] = '' self . unique = kwargs . pop ( 'unique' , True ) return super ( CountField , self ) . __init__ ( * args , ** kwargs )
Arguments:
            serializer_source: A serializer field.
            unique: Whether or not to perform a count of distinct elements.