IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> Python知识库 -> django-simpleui 删除按钮的问题 -> 正文阅读

[Python知识库]django-simpleui 删除按钮的问题

项目场景:

提示:这里简述项目相关背景:

Django-3.2.14 +django-simpleui-2022.7.29+openGauss3.0.0 删除按钮出现:“ psycopg2.errors.NotNullViolation: null value in column “change_message” violates not-null constraint” 的报错处理


问题描述

Django-3.2.14 +django-simpleui-2022.7.29+openGauss3.0.0 点击删除按钮出现:“ psycopg2.errors.NotNullViolation: null value in column “change_message” violates not-null constraint” 报错, 详细报错如下:

Internal Server Error: /admin/testapp/py_funtion/
Traceback (most recent call last):
File “/usr/local/lib/python3.7/site-packages/Django-3.2.14-py3.7.egg/django/db/backends/utils.py”, line 84, in _execute
return self.cursor.execute(sql, params)
psycopg2.errors.NotNullViolation: null value in column “change_message” violates not-null constraint
DETAIL: Failing row contains (23, 2022-09-08 14:18:55.752364+00, TEST, py_funtion object (TEST), 3, null, 9, 7).

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “/usr/local/lib/python3.7/site-packages/Django-3.2.14-py3.7.egg/django/core/handlers/exception.py”, line 47, in inner
response = get_response(request)
File “/usr/local/lib/python3.7/site-packages/Django-3.2.14-py3.7.egg/django/core/handlers/base.py”, line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File “/usr/local/lib/python3.7/site-packages/Django-3.2.14-py3.7.egg/django/contrib/admin/options.py”, line 616, in wrapper
return self.admin_site.admin_view(view)(*args, **kwargs)
File “/usr/local/lib/python3.7/site-packages/Django-3.2.14-py3.7.egg/django/utils/decorators.py”, line 130, in _wrapped_view
response = view_func(request, *args, **kwargs)
File “/usr/local/lib/python3.7/site-packages/Django-3.2.14-py3.7.egg/django/views/decorators/cache.py”, line 44, in _wrapped_view_func
response = view_func(request, *args, **kwargs)
File “/usr/local/lib/python3.7/site-packages/Django-3.2.14-py3.7.egg/django/contrib/admin/sites.py”, line 232, in inner
return view(request, *args, **kwargs)
File “/usr/local/lib/python3.7/site-packages/Django-3.2.14-py3.7.egg/django/utils/decorators.py”, line 43, in _wrapper
return bound_method(*args, **kwargs)
File “/usr/local/lib/python3.7/site-packages/Django-3.2.14-py3.7.egg/django/utils/decorators.py”, line 130, in _wrapped_view
response = view_func(request, *args, **kwargs)
File “/usr/local/lib/python3.7/site-packages/Django-3.2.14-py3.7.egg/django/contrib/admin/options.py”, line 1739, in changelist_view
response = self.response_action(request, queryset=cl.get_queryset(request))
File “/usr/local/lib/python3.7/site-packages/Django-3.2.14-py3.7.egg/django/contrib/admin/options.py”, line 1408, in response_action
response = func(self, request, queryset)
File “/usr/local/lib/python3.7/site-packages/Django-3.2.14-py3.7.egg/django/contrib/admin/actions.py”, line 44, in delete_selected
modeladmin.log_deletion(request, obj, obj_display)
File “/usr/local/lib/python3.7/site-packages/Django-3.2.14-py3.7.egg/django/contrib/admin/options.py”, line 849, in log_deletion
action_flag=DELETION,
File “/usr/local/lib/python3.7/site-packages/Django-3.2.14-py3.7.egg/django/contrib/admin/models.py”, line 35, in log_action
change_message=change_message,
File “/usr/local/lib/python3.7/site-packages/Django-3.2.14-py3.7.egg/django/db/models/manager.py”, line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File “/usr/local/lib/python3.7/site-packages/Django-3.2.14-py3.7.egg/django/db/models/query.py”, line 453, in create
obj.save(force_insert=True, using=self.db)
File “/usr/local/lib/python3.7/site-packages/Django-3.2.14-py3.7.egg/django/db/models/base.py”, line 740, in save
force_update=force_update, update_fields=update_fields)
File “/usr/local/lib/python3.7/site-packages/Django-3.2.14-py3.7.egg/django/db/models/base.py”, line 778, in save_base
force_update, using, update_fields,
File “/usr/local/lib/python3.7/site-packages/Django-3.2.14-py3.7.egg/django/db/models/base.py”, line 881, in _save_table
results = self._do_insert(cls._base_manager, using, fields, returning_fields, raw)
File “/usr/local/lib/python3.7/site-packages/Django-3.2.14-py3.7.egg/django/db/models/base.py”, line 921, in _do_insert
using=using, raw=raw,
File “/usr/local/lib/python3.7/site-packages/Django-3.2.14-py3.7.egg/django/db/models/manager.py”, line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File “/usr/local/lib/python3.7/site-packages/Django-3.2.14-py3.7.egg/django/db/models/query.py”, line 1270, in _insert
return query.get_compiler(using=using).execute_sql(returning_fields)
File “/usr/local/lib/python3.7/site-packages/Django-3.2.14-py3.7.egg/django/db/models/sql/compiler.py”, line 1416, in execute_sql
cursor.execute(sql, params)
File “/usr/local/lib/python3.7/site-packages/Django-3.2.14-py3.7.egg/django/db/backends/utils.py”, line 98, in execute
return super().execute(sql, params)
File “/usr/local/lib/python3.7/site-packages/Django-3.2.14-py3.7.egg/django/db/backends/utils.py”, line 66, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File “/usr/local/lib/python3.7/site-packages/Django-3.2.14-py3.7.egg/django/db/backends/utils.py”, line 75, in _execute_with_wrappers
return executor(sql, params, many, context)
File “/usr/local/lib/python3.7/site-packages/Django-3.2.14-py3.7.egg/django/db/backends/utils.py”, line 84, in _execute
return self.cursor.execute(sql, params)
File “/usr/local/lib/python3.7/site-packages/Django-3.2.14-py3.7.egg/django/db/utils.py”, line 90, in exit
raise dj_exc_value.with_traceback(traceback) from exc_value
File “/usr/local/lib/python3.7/site-packages/Django-3.2.14-py3.7.egg/django/db/backends/utils.py”, line 84, in _execute
return self.cursor.execute(sql, params)
django.db.utils.IntegrityError: null value in column “change_message” violates not-null constraint
DETAIL: Failing row contains (23, 2022-09-08 14:18:55.752364+00, TEST, py_funtion object (TEST), 3, null, 9, 7).

原因分析:

注意到如下报错:
null value in column “change_message” violates not-null constraint
初步判断是 django-simpleui 管理的表结构有问题, 在 openGauss 适配过程中的问题, 检查发现表 django_admin_log 的 change_message 字段是 NOT NULL


解决方案:

登录 openGauss 数据库, 修改表 django_admin_log 的 change_message 字段 将 NOT NULL 修改为 NULL, 重新启动 python3 manage.py runserver 问题解决。

  Python知识库 最新文章
Python中String模块
【Python】 14-CVS文件操作
python的panda库读写文件
使用Nordic的nrf52840实现蓝牙DFU过程
【Python学习记录】numpy数组用法整理
Python学习笔记
python字符串和列表
python如何从txt文件中解析出有效的数据
Python编程从入门到实践自学/3.1-3.2
python变量
上一篇文章      下一篇文章      查看所有文章
加:2022-09-13 11:10:10  更:2022-09-13 11:13:57 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年11日历 -2024/11/15 10:16:07-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码