请问如何按照开始日期和结束日期过滤curd列表的数据?还有时区问题

发布于 2022-04-26 18:04:44

新建位图图像.jpg

我在制作一个列表,查询历史数据,需要按更新时间进行查询
使用了如何代码:
{

  title: '更新时间',
  key: 'update_datetime',
  width: 160,
  search: {
    disabled: false,
    width: 300,
    type: 'daterange',
    component: {
      name: 'el-date-picker',
      props: {
        type: 'daterange',
        'range-separator': '至',
        'start-placeholder': '开始',
        'end-placeholder': '结束',
        format: 'yyyy-MM-dd'
      }
    }
  },
  type: 'datetime',
  sortable: true,
  form: {
    disabled: true
  }
},
在点击查询时,后台提示:
MySQL backend does not support timezone-aware datetimes when USE_TZ is False.
我该怎么做?

查看更多

关注者
1
被浏览
1.9k
yuanxiaotian
yuanxiaotian django/vue 2022-04-27
python/vue

前端需要配置 valueFormat:'yyyy-MM-dd'

3 个回答
hongzai
hongzai 认证专家 2022-04-26
life is coding,外包,远程协助,咨询添加微信:H0nGzA1

1.django需要设置utc时区
2.后台配置filters_fields
3.参考d2-crud-plus文档写对应回调函数处理过滤数据

2022-04-27
这家伙很懒,什么也没写!

谢谢两位,目前前端已正常,但是查不到数据,以下是发出的查询请求:
http://127.0.0.1:8000/api/modbus485/yaoce_his/?update_datetime=2022-04-27&update_datetime=2022-04-27&limit=20&page=1
现在应该怎么办呢?

撰写答案

请登录后再发布答案,点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览