returns a Django orm query from json input:
        {
        "app": "auth",
        "model": "User",
        "filters": {
            "is_superuser": False,
            "username__icontains": "foo"
        }

def query(self, jsonq, operator="and", count=False):
        """
        returns a Django orm query from json input:
        {
        "app": "auth",
        "model": "User",
        "filters": {
            "is_superuser": False,
            "username__icontains": "foo"
        }
        """
        model = self._get_model(jsonq["app"], jsonq["model"])
        fdict = jsonq["filters"]
        filters = []
        try:
            q = model.objects.none()
        except Exception as e:
            self.err(e)
        for label in fdict:
            kwargs = {label: fdict[label]}
            filters.append(Q(**kwargs))
        if filters == []:
            try:
                q = model.objects.all()
                return q
            except Exception as e:
                self.err(e)
        else:
            fq = Q()
            for f in filters:
                if operator == "and":
                    fq = fq & f
                elif operator == "or":
                    fq = fq | f
            if count is False:
                try:
                    q = model.objects.filter(fq)
                except Exception as e:
                    self.err(e)
            else:
                try:
                    q = model.objects.filter(fq).count()
                except Exception as e:
                    self.err(e)
        return q