08 2021 档案

摘要:1. Django ORM执行原生SQL 在模型查询API不够用的情况下,我们还可以使用原始的SQL语句进行查询。 Django 提供两种方法使用原始SQL进行查询:一种是使用raw()方法,进行原始SQL查询并返回模型实例;另一种是完全避开模型层,直接执行自定义的SQL语句。 执行原生查询 raw 阅读全文
posted @ 2021-08-10 14:23 Οo白麒麟оΟ 阅读(123) 评论(0) 推荐(0) 编辑
摘要:import time import requests import json class WeChat: def __init__(self): self.CORPID = 'ww2e1234567895498f5498f' #企业ID,在管理后台获取 self.CORPSECRET = 'xy1 阅读全文
posted @ 2021-08-09 08:09 Οo白麒麟оΟ 阅读(693) 评论(0) 推荐(0) 编辑
摘要:1.获取指定年份月份之间的间隔日期列表 import datetime from calendar import Calendar def get_year_dates(year: int, date_format: str = '%Y%m%d', start_month=1, end_month= 阅读全文
posted @ 2021-08-07 20:07 Οo白麒麟оΟ 阅读(351) 评论(0) 推荐(0) 编辑
摘要:orm - 为什么django的prefetch_related()只能用于all()而不能用于filter()? 假设我有这个模型: class PhotoAlbum(models.Model): title = models.CharField(max_length=128) author = 阅读全文
posted @ 2021-08-04 16:39 Οo白麒麟оΟ 阅读(86) 评论(0) 推荐(0) 编辑
摘要:ForeignKey(ForeignObject) blog = models.ForeignKey( to="Blog", to_field="nid", on_delete=models.DO_NOTHING) # 外键关联博客,一个博客站点可以有多个分类 字段 to, # 要进行关联的表名 t 阅读全文
posted @ 2021-08-03 14:40 Οo白麒麟оΟ 阅读(156) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示