Python,Django - loaddata问题" RemovedInDjango18Warning"

时间:2014-12-15 19:12:50

标签: python django

我有一个本地python环境,但是当我尝试加载初始数据时。

python manage.py loaddata initial_data.json 我收到一条错误消息" RemovedInDjango18Warning"?

我不是一个python开发者 - 所以这个错误对我来说是新的。

C:\Python27\aasoo>python manage.py loaddata initial_data.json
C:\Python27\lib\site-packages\djorm_pgfulltext\models.py:323: RemovedInDjango18Warning: `SearchManagerMixIn.get_query_set` method should be renamed `get_queryset`.
  class SearchManager(SearchManagerMixIn, models.Manager):

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 385, in execute_from_command_line
    utility.execute()
  File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 377, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Python27\lib\site-packages\django\core\management\base.py", line 288, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "C:\Python27\lib\site-packages\django\core\management\base.py", line 338, in execute
    output = self.handle(*args, **options)
  File "C:\Python27\lib\site-packages\modeltranslation\management\commands\loaddata.py", line 50, in handle
    return super(Command, self).handle(*fixture_labels, **options)
  File "C:\Python27\lib\site-packages\django\core\management\commands\loaddata.py", line 61, in handle
    self.loaddata(fixture_labels)
  File "C:\Python27\lib\site-packages\django\core\management\commands\loaddata.py", line 91, in loaddata
    self.load_label(fixture_label)
  File "C:\Python27\lib\site-packages\django\core\management\commands\loaddata.py", line 142, in load_label
    for obj in objects:
  File "C:\Python27\lib\site-packages\django\core\serializers\json.py", line 81, in Deserializer
    six.reraise(DeserializationError, DeserializationError(e), sys.exc_info()[2])
  File "C:\Python27\lib\site-packages\django\core\serializers\json.py", line 75, in Deserializer
    for obj in PythonDeserializer(objects, **options):
  File "C:\Python27\lib\site-packages\django\core\serializers\python.py", line 122, in Deserializer
    m2m_data[field.name] = [m2m_convert(pk) for pk in field_value]
django.core.serializers.base.DeserializationError: Problem installing fixture 'C:\Python27\aasoo\content\fixtures\initial_data.json': 'int' object is not iterable

C:\Python27\aasoo>

1 个答案:

答案 0 :(得分:0)

您应该在SearchManagerMixIn中将get_query_set重命名为get_queryset。如果您需要更多帮助,可以粘贴课程的定义。