Fixed #16731 -- Made pattern lookups work properly with F() expressions

See https://code.djangoproject.com/ticket/16731#comment:11
How about:
```
r"""LIKE BINARY CONCAT('%%%%',
    REPLACE(
        REPLACE(
            REPLACE(%s, '\\', '\\\\'),
        '%%%%', '\%%%%'),
    '_', '\_'),
'%%%%')"""
```