近7天数据
12SELECT * from oms_order_item_comment where comment_time between date_sub(now(),interval 1 week) and now() -- 七天
半年数据
12SELECT * from oms_order_item_comment ...
转载于这里
说明Django创建项目后,在settings.py中默认加载了以下几个app:
12345678INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.conten...
文章转载于这里
最近碰到一个需求,要对用户的学历进行排序,也就是按照[‘中专及以下’, ‘高中’, ‘大专’, ‘本科’, ‘硕士’, ‘博士’]的顺序进行排序,这就需要使用Django的ORM实现按指定字段的值进行排序。
MySQL中的SQL语句的语法:
1select * from user_education where user_id = ...
GO安装go-redis时,报verifying github.com/go-redis/redis@v6.15.9+incompatible: github.com/go-redis/redis@v6.15.9+incompatible: Get https://sum.golang.org/lookup/github.com/go-redis/re...
Gin 中使用gormt将mysql数据库自动生成gorm结构体后:12go get -u -v github.com/xxjwxc/gormt@mastergormt -H=127.0.0.1 -d=oauth_db -p=qwer -u=root --port=3306
再此运行Gin时会报123build command-line-argumen...
需求在项目中使用Django admin作为后台管理,在店铺表编辑页面需要设置省市区三级联动,查了很多资源,没有发现原生支持的联动方式。 在网上借鉴了别人的写法。
配置:
Python 3.7
Django3.1
步骤
在app文件下创建templates文件夹,创建shop_detail.html用于复写店铺编辑页。 文件名字可自定义。
在...
介绍装饰器本质上是一个Python函数,它可以让其他函数在不需要做任何代码变动的前提下增加额外功能,装饰器的返回值也是一个函数对象。
它经常用于有切面需求的场景,比如:插入日志、性能测试、事务处理、缓存、权限校验等场景。
装饰器是解决这类问题的绝佳设计,有了装饰器,我们就可以抽离出大量与函数功能本身无关的雷同代码并继续重用。
装饰器的使用方法很固定
...
This blog is from here
When starting a new Python project, it is tempting to just dive in and start coding. Spending a tiny amount of time to setup a project with the best tools...
转载自这里
datetime模块介绍datetime模块中包含如下类:
类名
功能说明
date
日期对象,常用的属性有year, month, day
time
时间对象
datetime
日期时间对象,常用的属性有hour, minute, second, microsecond
datetime_CAPI
日期时间对象C语...
Calendar
setfirstweekday(firstweekday) 指定一周的第一天,0是星期一,… 6为星期日
firstweekday():返回一周的第一天,0是星期一,…,6为星期日
isleap(year):判断指定是否是闰年,闰年为True,平年为False
leapdays(y1, y2):返回y1与y2年份之间的闰年数量...