问题
[2023-09-05 10:23:41][dvadmin.utils.exception.CustomExceptionHandler():64] [ERROR] Traceback (most recent call last):
File "D:\InstallSpace\Anaconda3\envs\py39\lib\site-packages\rest_framework\views.py", line 506, in dispatch
response = handler(request, *args, **kwargs)
File "D:\WorkSpace\django-vue-admin-main\backend\mpbs\views.py", line 37, in add_users
sub_user_id_model = SubUserIdModel(sub=user.get('sub'), user_id=user_id, login_name=login_name)
File "D:\InstallSpace\Anaconda3\envs\py39\lib\site-packages\django\db\models\base.py", line 413, in init
raise TypeError('Abstract models cannot be instantiated.')
TypeError: Abstract models cannot be instantiated.
Traceback (most recent call last):
File "D:\InstallSpace\Anaconda3\envs\py39\lib\site-packages\rest_framework\views.py", line 506, in dispatch
response = handler(request, *args, **kwargs)
File "D:\WorkSpace\django-vue-admin-main\backend\mpbs\views.py", line 37, in add_users
sub_user_id_model = SubUserIdModel(sub=user.get('sub'), user_id=user_id, login_name=login_name)
File "D:\InstallSpace\Anaconda3\envs\py39\lib\site-packages\django\db\models\base.py", line 413, in init
raise TypeError('Abstract models cannot be instantiated.')
TypeError: Abstract models cannot be instantiated.
方案
abstract=True,即可解决。