Python Django';QCombination';对象是不可编辑的

Python Django';QCombination';对象是不可编辑的,python,django,django-models,Python,Django,Django Models,我正在创建一个Django命令,但不断出现以下错误: Traceback (most recent call last): File "manage.py", line 13, in <module> execute_from_command_line(sys.argv) File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 353,

我正在创建一个Django命令,但不断出现以下错误:

Traceback (most recent call last):
    File "manage.py", line 13, in <module>
        execute_from_command_line(sys.argv)
    File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
        utility.execute()
    File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 345, in execute
        self.fetch_command(subcommand).run_from_argv(self.argv)
    File "/usr/local/lib/python2.7/site-packages/django/core/management/base.py", line 348, in run_from_argv
        self.execute(*args, **cmd_options)
    File "/usr/local/lib/python2.7/site-packages/django/core/management/base.py", line 399, in execute
        output = self.handle(*args, **options)
    File "/Users/mkhan/dev/TolaTables/silo/management/commands/push_to_gsheet.py", line 33, in handle
        read_types = ReadType.objects.filter(reduce(or_, [Q(read_type__iexact="GSheet Import"), Q(read_type__iexact='Google Spreadsheet')] ))
    File "/usr/local/lib/python2.7/site-packages/django/db/models/manager.py", line 122, in manager_method
        return getattr(self.get_queryset(), name)(*args, **kwargs)
    File "/usr/local/lib/python2.7/site-packages/django/db/models/query.py", line 790, in filter
        return self._filter_or_exclude(False, *args, **kwargs)
    File "/usr/local/lib/python2.7/site-packages/django/db/models/query.py", line 808, in _filter_or_exclude
        clone.query.add_q(Q(*args, **kwargs))
    File "/usr/local/lib/python2.7/site-packages/django/db/models/sql/query.py", line 1243, in add_q
        clause, _ = self._add_q(q_object, self.used_aliases)
    File "/usr/local/lib/python2.7/site-packages/django/db/models/sql/query.py", line 1269, in _add_q
        allow_joins=allow_joins, split_subq=split_subq,
    File "/usr/local/lib/python2.7/site-packages/django/db/models/sql/query.py", line 1146, in build_filter
        arg, value = filter_expr
TypeError: 'QCombination' object is not iterable

我尝试从python交互式shell中运行相同的代码,它运行得很好,没有任何错误。

合理性检查:如果您要避免通配符导入,该怎么办。修复思洛存储器中的
模型导入*
和思洛存储器中的
视图导入*
-同样的问题?谢谢!我用特定对象替换了通配符导入,这使它工作起来了!健全性检查:如果要避免通配符导入,该怎么办。修复思洛存储器中的
模型导入*
和思洛存储器中的
视图导入*
-同样的问题?谢谢!我用特定对象替换了通配符导入,这使它工作起来了!
import requests, json
from requests.auth import HTTPDigestAuth

from django.core.management.base import BaseCommand, CommandError
from django.db.models import Q
from operator import and_, or_
from django.utils import timezone

from silo.models import *
from tola.util import siloToDict, combineColumns
from silo.google_views import *


class Command(BaseCommand):
    """
    Usage: python manage.py push_to_gsheet --f weekly
    """
    help = 'Pushes all reads that have autopush checked and belong to a silo'

    def add_arguments(self, parser):
        parser.add_argument("-f", "--frequency", type=str, required=True)

    def handle(self, *args, **options):
        frequency = options['frequency']
        if frequency != "daily" and frequency != "weekly":
            return self.stdout.write("Frequency argument can either be 'daily' or 'weekly'")

        # Get all silos that have a unique field setup, have autopush frequency selected and autopush frequency is the same as specified in this command line argument.
        silos = Silo.objects.filter(unique_fields__isnull=False, reads__autopush_frequency__isnull=False, reads__autopush_frequency = frequency).distinct()
        #read_types = ReadType.objects.filter( Q(read_type__iexact="GSheet Import") | Q(read_type__iexact='Google Spreadsheet') )
        self.stdout.write("about to get read_types")
        read_types = ReadType.objects.filter(reduce(or_, [Q(read_type__iexact="GSheet Import"), Q(read_type__iexact='Google Spreadsheet')] ))