Loading

上一页 1 2 3 4 5 6 7 ··· 9 下一页
摘要: 问题 想要在 orm 中定义外键,便于关联查询,但不想在数据库中生成实际的外键约束。 解决方式 Django 的 ForeignKey 和数据库的 FOREIGN KEY 并不一样。Django 的 ForeignKey 是一种逻辑上的两个表的关联关系,可以指定是否使用数据库的 FOREIGN KE 阅读全文
posted @ 2024-06-25 22:36 kingron 阅读(280) 评论(0) 推荐(0)
摘要: 代码如下: from django.db import connections with connections['db_to_create_a_table_in'].schema_editor() as schema_editor: schema_editor.create_model(YourU 阅读全文
posted @ 2024-06-25 22:28 kingron 阅读(24) 评论(0) 推荐(0)
摘要: 1. Django 的 QuerySet 是惰性的 Django 的 QuerySet 对应于数据库的若干记录(row),通过可选的查询来过滤。例如,下面的代码会得到数据库中名字为 Dave 的所有的人: person_set = Person.objects.filter(first_name=" 阅读全文
posted @ 2024-06-25 22:26 kingron 阅读(67) 评论(0) 推荐(0)
摘要: How to enlarge the maximum size of the message delivered to Kafka? From: Frequently Asked Questions For large transactions it is possible that Kafka C 阅读全文
posted @ 2024-06-25 16:41 kingron 阅读(449) 评论(0) 推荐(0)
摘要: 撤销 rebase 查看本地记录: git reflog 在 reflog 中找到本次 rebase 之前的 id 回退到对应的 id git reset --hard <第2步拿到的id> 如果此时仍处于 rebase 状态,使用命令取消: git rebase --abort 合并时处理发生变更 阅读全文
posted @ 2024-06-24 13:03 kingron 阅读(37) 评论(0) 推荐(0)
摘要: Push failed: Unable to access 'https://github.com/financialfly/lzz.git/': OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443 因为 Gi 阅读全文
posted @ 2024-06-24 13:00 kingron 阅读(43) 评论(0) 推荐(0)
摘要: GitHub 创建仓库提示代码 echo "# 项目名" >> README.md git init git add README.md git commit -m "first commit" git remote add origin git@github.com:qiubaiying/项目名. 阅读全文
posted @ 2024-06-24 12:52 kingron 阅读(11) 评论(0) 推荐(0)
摘要: 最近使用 Silence v3.0.0-rc2 主题遇到两个偏好问题(感谢作者提供了这么好用的主题),记录下处理的过程。 暗黑/亮色模式跟随浏览器的主题切换 由于主题当前支持的配置项 auto 是根据时间定的,而不是根据浏览器的配置来的,而我个人偏向于跟随浏览器的配置来自动设置,于是用 js 先判断 阅读全文
posted @ 2024-06-22 10:33 kingron 阅读(234) 评论(0) 推荐(0)
摘要: 参考 转载自 mysql binlog日志自动清理及手动删除 - 景岳 - 博客园 说明 当开启 mysql 数据库主从时,会产生大量如 mysql-bin.00000* log 的文件,这会大量耗费您的硬盘空间。 mysql-bin.000001 mysql-bin.000002 mysql-bi 阅读全文
posted @ 2024-06-21 21:41 kingron 阅读(180) 评论(0) 推荐(0)
摘要: select_related 方法 在常规 models 操作中,某些对于关联表的查询稍有不慎可能导致产生多次查询,如: # views.py from . import models def test(request): '''假设有一张user表,其关联表为`usertype`,关联字段为`ut 阅读全文
posted @ 2024-06-21 08:43 kingron 阅读(231) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 ··· 9 下一页