ArrayField缺少1个必需的位置参数

狙击手

我已导入以下头文件

from django.contrib.postgres.fields import ArrayField

在模型中使用以下

question_array = ArrayField(models.IntegerField, blank=True,)

我收到以下错误

Traceback (most recent call last)
  File "C:\Program Files (x86)\Python\Python35-32\lib\site-packages\django-1.10.4-py3.5.egg\django\__init__.py", line 27, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "C:\Program Files (x86)\Python\Python35-32\lib\site-packages\django-1.10.4-py3.5.egg\django\apps\registry.py", line 108, in populate
    app_config.import_models(all_models)
  File "C:\Program Files (x86)\Python\Python35-32\lib\site-packages\django-1.10.4-py3.5.egg\django\apps\config.py", line 199, in import_models
    self.models_module = import_module(models_module_name)
  File "C:\Program Files (x86)\Python\Python35-32\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 665, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "C:\Users\DELL\Desktop\cstrom\comp\models.py", line 24, in <module>
    class User(models.Model):
  File "C:\Program Files (x86)\Python\Python35-32\lib\site-packages\django-1.10.4-py3.5.egg\django\db\models\base.py", line 157, in __new__
    new_class.add_to_class(obj_name, obj)
  File "C:\Program Files (x86)\Python\Python35-32\lib\site-packages\django-1.10.4-py3.5.egg\django\db\models\base.py", line 316, in add_to_class
    value.contribute_to_class(cls, name)
  File "C:\Program Files (x86)\Python\Python35-32\lib\site-packages\django-1.10.4-py3.5.egg\django\db\models\fields\__init__.py", line 689, in contribute_to_class
    self.set_attributes_from_name(name)
  File "C:\Program Files (x86)\Python\Python35-32\lib\site-packages\django-1.10.4-py3.5.egg\django\contrib\postgres\fields\array.py", line 75, in set_attributes_from_name
    self.base_field.set_attributes_from_name(name)
TypeError: set_attributes_from_name() missing 1 required positional argument: 'name'

根据文档

您仍然需要完全定义数组字段中的字段

question_array = ArrayField(models.IntegerField(null=True, blank=True), blank=True,)

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

__init __()缺少1个必需的位置参数

缺少1个必需的位置参数:“ pk”

缺少1个必需的位置参数:“键”

python缺少1个必需的位置参数

channel()缺少1个必需的位置参数

AssertTrue 缺少 1 个必需的位置参数

缺少1个必需的位置参数:“循环”

缺少 1 个必需的位置参数:“数字”

缺少1个必需的位置参数:'self'

缺少1个必需的位置参数:“ msg”

缺少1个必需的位置参数

缺少 1 个必需的位置参数 dt

函数缺少 1 个必需的位置参数

缺少 1 个必需的位置参数 [Telebot]

method1()缺少1个必需的位置参数:“ self”

__init__() 缺少 1 个必需的位置参数:'self'

类型错误:post() 缺少 1 个必需的位置参数

类型错误:readData() 缺少 1 个必需的位置参数:“数据”

TypeError:detail()缺少1个必需的位置参数:“ request”

TypeError:predict()缺少1个必需的位置参数:“ params”

多处理,缺少 1 个必需的位置参数:“响应”

setUpClass()缺少1个必需的位置参数:“ cls”

TypeError:fit()缺少1个必需的位置参数:'y'

load_model()缺少1个必需的位置参数:“ filepath”

TypeError:append()缺少1个必需的位置参数:“ values”

django 模板标签缺少 1 个必需的位置参数:值

geopy TypeError:geocode()缺少1个必需的位置参数:“ query”

TypeError:setDocumentLocator()缺少1个必需的位置参数:“ locator”

Django模型属性:缺少1个必需的位置参数: