feat(user): 新增daterange过滤示例
parent
3a007fe8ab
commit
58831b2480
|
@ -249,16 +249,17 @@ class UserViewSet(CustomModelViewSet):
|
||||||
serializer_class = UserSerializer
|
serializer_class = UserSerializer
|
||||||
create_serializer_class = UserCreateSerializer
|
create_serializer_class = UserCreateSerializer
|
||||||
update_serializer_class = UserUpdateSerializer
|
update_serializer_class = UserUpdateSerializer
|
||||||
filter_fields = ["^name", "~username", "^mobile", "is_active", "dept", "user_type", "$dept__name"]
|
# filter_fields = ["^name", "~username", "^mobile", "is_active", "dept", "user_type", "$dept__name"]
|
||||||
# filter_fields = {
|
filter_fields = {
|
||||||
# "name": ["icontains"],
|
"name": ["icontains"],
|
||||||
# "mobile": ["iregex"],
|
"mobile": ["iregex"],
|
||||||
# "username": ["icontains"],
|
"username": ["icontains"],
|
||||||
# "is_active": ["icontains"],
|
"is_active": ["icontains"],
|
||||||
# "dept": ["exact"],
|
"dept": ["exact"],
|
||||||
# "user_type": ["exact"],
|
"user_type": ["exact"],
|
||||||
# "dept__name": ["icontains"],
|
"dept__name": ["icontains"],
|
||||||
# }
|
"create_datetime": ["range"],
|
||||||
|
}
|
||||||
search_fields = ["username", "name", "gender", "dept__name", "role__name"]
|
search_fields = ["username", "name", "gender", "dept__name", "role__name"]
|
||||||
# 导出
|
# 导出
|
||||||
export_field_label = {
|
export_field_label = {
|
||||||
|
|
|
@ -404,7 +404,7 @@ export const crudOptions = (vm) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
].concat(vm.commonEndColumns({
|
].concat(vm.commonEndColumns({
|
||||||
create_datetime: { showTable: false },
|
create_datetime: { showTable: false, showForm: true },
|
||||||
update_datetime: { showTable: false }
|
update_datetime: { showTable: false }
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue