def formfield_for_foreignkey(self, db_field, request, **kwargs):
        if db_field.name == 'site':
            kwargs['queryset'] = Site.select_by_user(request.user)

        if db_field.name == 'deployment':
            kwargs['queryset'] = Deployment.select_by_user(request.user)

        if db_field.name == 'controller':
            if 0 > len(resolve(request.path).args):
                kwargs['queryset'] = Controller.select_by_user(request.user).filter(
                    deployment__id=int(resolve(request.path).args[0]))

        return super(SiteDeploymentInline, self).formfield_for_foreignkey(db_field, request, **kwargs)
dataset/ETHPy150Open open-cloud/xos/xos/core/admin.py/SiteDeploymentInline.formfield_for_foreignkey/swapped operands of `>`