我试图将我的用户模型 CustomUser 重命名为 User。
以下是我所做的:
- 重命名 Python 类和所有引用
- 执行 makemigrations
Did you rename the accounts.CustomUser model to User? [y/N] y
Traceback (most recent call last):
File "manage.py", line 21, in <module>
main()
File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
File "/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/venv/lib/python3.7/site-packages/django/core/management/base.py", line 330, in run_from_argv
self.execute(*args, **cmd_options)
File "/venv/lib/python3.7/site-packages/django/core/management/base.py", line 371, in execute
output = self.handle(*args, **options)
File "/venv/lib/python3.7/site-packages/django/core/management/base.py", line 85, in wrapped
res = handle_func(*args, **kwargs)
File "/venv/lib/python3.7/site-packages/django/core/management/commands/makemigrations.py", line 168, in handle
migration_name=self.migration_name,
File "/venv/lib/python3.7/site-packages/django/db/migrations/autodetector.py", line 43, in changes
changes = self._detect_changes(convert_apps, graph)
File "/venv/lib/python3.7/site-packages/django/db/migrations/autodetector.py", line 186, in _detect_changes
self.generate_altered_fields()
File "/venv/lib/python3.7/site-packages/django/db/migrations/autodetector.py", line 959, in generate_altered_fields
dependencies.extend(self._get_dependencies_for_foreign_key(new_field))
File "/venv/lib/python3.7/site-packages/django/db/migrations/autodetector.py", line 1086, in _get_dependencies_for_foreign_key
dep_app_label = field.remote_field.model._meta.app_label
AttributeError: 'SettingsReference' object has no attribute '_meta'
我被这个异常卡住了,非常感谢任何帮助 :)