DongTai-web icon indicating copy to clipboard operation
DongTai-web copied to clipboard

[Bug]:

Open zha0cai opened this issue 1 year ago • 0 comments

Preflight Checklist

  • [X] I agree to follow the Code of Conduct that this project adheres to.
  • [X] I have searched the issue tracker for an issue that matches the one I want to file, without success.
  • [X] I am not looking for support or already pursued the available support channels without success.

Version

1.9.3

Installation Type

Official Docker Compose

Service Name

DongTai-Web

Describe the details of the bug and the steps to reproduce it

  1. 从 1.9.2 升级到 1.9.3 之后新建项目无法保存项目信息,提示参数错误
  2. 查看 dongtai-server-1 日志,查找资料 stackoverflow.com,请问是环境问题还是数据问题
  3. 题外话,策略模板管理能不能提供全选删除按钮

Additional Information

No response

Logs

# dongtai-server-1 logs

[pid: 69|app: 0|req: 1948/2671] ipaddr () {38 vars in 574 bytes} [Thu Mar 23 17:53:54 2023] POST /api/v1/report/upload => generated 60 bytes in 32 msecs (HTTP/1.0 200) 10 headers in 380 bytes (1 switches on core 5)
ERROR 2023-03-23 17:54:02,627 [project_add.post:185] The database backend does not accept 0 as a value for AutoField.
Traceback (most recent call last):
  File "/opt/dongtai/./dongtai_web/views/project_add.py", line 178, in post
    project.save(update_fields=[
  File "/usr/local/lib/python3.10/site-packages/django/db/models/base.py", line 739, in save
    self.save_base(using=using, force_insert=force_insert,
  File "/usr/local/lib/python3.10/site-packages/django/db/models/base.py", line 776, in save_base
    updated = self._save_table(
  File "/usr/local/lib/python3.10/site-packages/django/db/models/base.py", line 858, in _save_table
    updated = self._do_update(base_qs, using, pk_val, values, update_fields,
  File "/usr/local/lib/python3.10/site-packages/django/db/models/base.py", line 912, in _do_update
    return filtered._update(values) > 0
  File "/usr/local/lib/python3.10/site-packages/django/db/models/query.py", line 802, in _update
    return query.get_compiler(self.db).execute_sql(CURSOR)
  File "/usr/local/lib/python3.10/site-packages/django/db/models/sql/compiler.py", line 1559, in execute_sql
    cursor = super().execute_sql(result_type)
  File "/usr/local/lib/python3.10/site-packages/django/db/models/sql/compiler.py", line 1162, in execute_sql
    sql, params = self.as_sql()
  File "/usr/local/lib/python3.10/site-packages/django/db/backends/mysql/compiler.py", line 44, in as_sql
    update_query, update_params = super().as_sql()
  File "/usr/local/lib/python3.10/site-packages/django/db/models/sql/compiler.py", line 1525, in as_sql
    val = field.get_db_prep_save(val, connection=self.connection)
  File "/usr/local/lib/python3.10/site-packages/django/db/models/fields/related.py", line 971, in get_db_prep_save
    return self.target_field.get_db_prep_save(value, connection=connection)
  File "/usr/local/lib/python3.10/site-packages/django/db/models/fields/__init__.py", line 842, in get_db_prep_save
    return self.get_db_prep_value(value, connection=connection, prepared=False)
  File "/usr/local/lib/python3.10/site-packages/django/db/models/fields/__init__.py", line 2487, in get_db_prep_value
    value = connection.ops.validate_autopk_value(value)
  File "/usr/local/lib/python3.10/site-packages/django/db/backends/mysql/operations.py", line 236, in validate_autopk_value
    raise ValueError('The database backend does not accept 0 as a '
ValueError: The database backend does not accept 0 as a value for AutoField.
[pid: 69|app: 0|req: 1949/2672] ipaddr () {42 vars in 909 bytes} [Thu Mar 23 17:54:02 2023] POST /api/v1/project/add => generated 50 bytes in 231 msecs (HTTP/1.0 200) 11 headers in 428 bytes (1 switches on core 7)

zha0cai avatar Mar 23 '23 10:03 zha0cai