コード例 #1
0
ファイル: forms.py プロジェクト: Jobava/zamboni
 def clean_device_and_dev(self):
     device = self.cleaned_data.pop('dev', None)
     device_type = self.cleaned_data.pop('device', None)
     # For android, we need to know the device type to determine the real
     # device we are going to filter with, because we distinguish between
     # mobile and tablets.
     if device == 'android' and device_type:
         device = '%s-%s' % (device, device_type)
     if device in DEVICE_LOOKUP:
         self.cleaned_data['device'] = DEVICE_LOOKUP.get(device).id
     elif device:
         raise forms.ValidationError('Invalid device or device type.')
コード例 #2
0
 def clean_device_and_dev(self):
     device = self.cleaned_data.pop('dev', None)
     device_type = self.cleaned_data.pop('device', None)
     # For android, we need to know the device type to determine the real
     # device we are going to filter with, because we distinguish between
     # mobile and tablets.
     if device == 'android' and device_type:
         device = '%s-%s' % (device, device_type)
     if device in DEVICE_LOOKUP:
         self.cleaned_data['device'] = DEVICE_LOOKUP.get(device).id
     elif device:
         raise forms.ValidationError('Invalid device or device type.')
コード例 #3
0
ファイル: views.py プロジェクト: JaredKerim-Mozilla/zamboni
    def _get_device(self, request):
        """
        Return device ID for ES to filter by (or None).
        Fireplace sends `dev` and `device`. See the API docs for more info.
        When `dev` is 'android' we also need to check `device` to pick a device
        object.
        """
        dev = request.QUERY_PARAMS.get('dev')
        device = request.QUERY_PARAMS.get('device')

        if dev == 'android' and device:
            dev = '%s-%s' % (dev, device)
        return getattr(DEVICE_LOOKUP.get(dev), 'id', None)
コード例 #4
0
ファイル: views.py プロジェクト: miltonpereira/zamboni
    def _get_device(self, request):
        """
        Return device ID for ES to filter by (or None).
        Fireplace sends `dev` and `device`. See the API docs for more info.
        When `dev` is 'android' we also need to check `device` to pick a device
        object.
        """
        dev = request.QUERY_PARAMS.get('dev')
        device = request.QUERY_PARAMS.get('device')

        if dev == 'android' and device:
            dev = '%s-%s' % (dev, device)
        return getattr(DEVICE_LOOKUP.get(dev), 'id', None)