It should be `request.device['is_mobile']` and not `request.device.is_mobile`
It should be
request.device['is_mobile']and notrequest.device.is_mobile