Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/360.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Django属性错误:";属性错误:模块';django.db.models';没有属性';曼尼托曼尼菲尔德'&引用;_Python_Django_Python 3.x - Fatal编程技术网

Python Django属性错误:";属性错误:模块';django.db.models';没有属性';曼尼托曼尼菲尔德'&引用;

Python Django属性错误:";属性错误:模块';django.db.models';没有属性';曼尼托曼尼菲尔德'&引用;,python,django,python-3.x,Python,Django,Python 3.x,我正在终端中执行这行代码: python manage.py makemigrations 我将此作为输出: 回溯(最近一次呼叫最后一次): 文件“manage.py”,第15行,在 从命令行(sys.argv)执行命令 文件“C:\Users\Bryan\AppData\Local\Programs\Python\Python37-32\lib\site packages\django\core\management\\ uuuuuuuu init\uuuuuuuuuu.py”,第381行,

我正在终端中执行这行代码:

python manage.py makemigrations
我将此作为输出:

回溯(最近一次呼叫最后一次):

文件“manage.py”,第15行,在
从命令行(sys.argv)执行命令
文件“C:\Users\Bryan\AppData\Local\Programs\Python\Python37-32\lib\site packages\django\core\management\\ uuuuuuuu init\uuuuuuuuuu.py”,第381行,从命令行执行
utility.execute()
文件“C:\Users\Bryan\AppData\Local\Programs\Python\Python37-32\lib\site packages\django\core\management\\ uuuuu init\uuuuu.py”,第357行,在execute中
django.setup()
文件“C:\Users\Bryan\AppData\Local\Programs\Python\Python37-32\lib\site packages\django\\uuuuuuu init\uuuuuuuuu.py”,第24行,在安装程序中
应用程序。填充(设置。已安装的应用程序)
文件“C:\Users\Bryan\AppData\Local\Programs\Python\Python37-32\lib\site packages\django\apps\registry.py”,第112行,在“填充”中
app_config.import_models()
文件“C:\Users\Bryan\AppData\Local\Programs\Python\Python37-32\lib\site packages\django\apps\config.py”,第198行,在导入模型中
self.models\u module=导入模块(models\u module\u name)
文件“C:\Users\Bryan\AppData\Local\Programs\Python\Python37-32\lib\importlib\\uuuuuu init\uuuuuu.py”,第127行,在导入模块中
return _bootstrap._gcd_import(名称[级别:],包,级别)
文件“”,第1006行,在\u gcd\u导入中
文件“”,第983行,在_find_和_load中
文件“”,第967行,在“查找”和“加载”中解锁
文件“”,第677行,在\u加载\u解锁
exec_模块中第728行的文件“”
文件“”,第219行,在“调用”中,删除了“帧”
文件“C:\Users\Bryan\Desktop\wisdompets\adoptions\models.py”,第3行,在
宠物类(型号.型号):
文件“C:\Users\Bryan\Desktop\wisdompets\adoptions\models.py”,第13行,在Pet中
疫苗接种=型号。ManytoManyField('Vaccine',blank=True)
**AttributeError:模块“django.db.models”没有属性“ManytoManyField”**

有人能告诉我我做错了什么吗?

t需要在ManyToManyField部分大写,疫苗也应该参考模型

如果它在不同的型号中。py

来自[Appname]。模型导入疫苗


疫苗接种=模型。ManyToManyField(疫苗,空白=真)

ManyToManyField
中的
To
带有大写字母。谢谢,在我开始使用Django实施项目之前,我将阅读更多文档
File "manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "C:\Users\Bryan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "C:\Users\Bryan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\management\__init__.py", line 357, in execute
    django.setup()
  File "C:\Users\Bryan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "C:\Users\Bryan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\apps\registry.py", line 112, in populate
    app_config.import_models()
  File "C:\Users\Bryan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\apps\config.py", line 198, in import_models
    self.models_module = import_module(models_module_name)
  File "C:\Users\Bryan\AppData\Local\Programs\Python\Python37-32\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\Users\Bryan\Desktop\wisdompets\adoptions\models.py", line 3, in <module>
    class Pet(models.Model):
  File "C:\Users\Bryan\Desktop\wisdompets\adoptions\models.py", line 13, in Pet
    vaccinations = models.ManytoManyField('Vaccine', blank=True)
**AttributeError: module 'django.db.models' has no attribute 'ManytoManyField'**