Django admin 根据新增还是编辑来显示 readonly_fields 字段 class AnchorBindAgentAdmin(admin.ModelAdmin): def get_readonly_fields(self, request, obj=None): """ Hook for specifying cus continue reading django zhuoyuebiji 2020/4/3 556
Django admin 列表禁用删除操作,编辑页面禁用删除按钮 class AnchorBindAgentAdmin(admin.ModelAdmin): def get_actions(self, request): # 列表禁用删除操作 if 'delete_selected' in actions: continue reading django zhuoyuebiji 2020/4/3 941
Django admin ForeignKey 字段增加搜索选择框 产生背景 当 ForeignKey 数据过多,手动在后台添加时不方便找到自己的想要数据,遂想要一个可以搜索检索数据功能。 检索文档 https://stackoverflow.com/questions/30214469/in-django-admin-how-to-ad continue reading django zhuoyuebiji 2020/4/1 1836
MacOS mysqlclient ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. 安装环境 Mac OS django 2.2 错误日志 pip install mysqlclient (qingjiu) yinzhuoqundeMacBook-Pro:QingJiuSystem yinzhuoqun$ pip install mysqlcl continue reading django zhuoyuebiji 2020/3/31 1121
Centos7 mysqlclient ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. 安装环境 django 2.2 centos 7 错误日志 pip install mysqlclient (qingjiu) [root@VM_16_3_centos running]# pip install mysqlclient Looking in continue reading django zhuoyuebiji 2020/3/30 870
Django 模板中使用 widthratio 标签实现 乘法、除法 运算 先看官方文档 http://doc.codingdict.com/django/ref/templates/builtins.html#std:templatetag-widthratio(中文) https://docs.djangoproject.com/zh-hans/2.2/re continue reading django zhuoyuebiji 2020/3/29 886
Django simpleUI 修改 element-UI 引用的 index.js 和 index.css 链接 以及 base.html 的 vue 资源链接 原来的 index.js 和 index.css 加载时间太慢: 在 simpleUI 下面的 templates(../site-packages/simpleui/templates/admin) 里面找到 base.html, index.html, login continue reading django zhuoyuebiji 2020/3/29 437
HINT: ForeignKey(unique=True) is usually better served by a OneToOneField. WARNINGS HINT: ForeignKey(unique=True) is usually better served by a OneToOneField. 警告的意思 django model 里面 ForeignKe 字段设置为 unique=Tr continue reading django zhuoyuebiji 2020/3/28 537
HINT: It seems you set a fixed date / time / datetime value as default for this field. This may not be what you want. If you want to have the current date as default, use `django.utils.timezone.now` WARNINGS operations.AnchorBindAgent.start_time: (fields.W161) Fixed default value provided. HINT: It seems you set a fixed date continue reading django zhuoyuebiji 2020/3/28 1192
Django CKEditor 上传图片提示“不正确的服务器响应”的解决办法 开发环境 django 1.11 django-ckeditor 5.3.1(CKEditor 4.7.3) 发生背景 前端页面引用了 CKEditor 富文本编辑器,Django 未登录的时候上传文件就会报:"不正确的服务器响应"。 错误提示 continue reading django zhuoyuebiji 2020/3/12 1330