Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_45031851
simpleui_demo
提交
96547a62
S
simpleui_demo
项目概览
weixin_45031851
/
simpleui_demo
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
simpleui_demo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
96547a62
编写于
5月 23, 2019
作者:
N
newpanjing
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
功能增加
上级
0a3fa187
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
35 addition
and
1 deletion
+35
-1
db.sqlite3
db.sqlite3
+0
-0
demo/admin.py
demo/admin.py
+32
-1
simpleui_demo/settings.py
simpleui_demo/settings.py
+3
-0
未找到文件。
db.sqlite3
浏览文件 @
96547a62
无法预览此类型文件
demo/admin.py
浏览文件 @
96547a62
import
datetime
from
django.contrib
import
admin
from
django.urls
import
reverse
...
...
@@ -38,13 +40,42 @@ class TitleAdmin(admin.ModelAdmin):
]
class
AgeListFilter
(
admin
.
SimpleListFilter
):
title
=
u
'最近生日'
parameter_name
=
'ages'
def
lookups
(
self
,
request
,
model_admin
):
return
(
(
'0'
,
u
'最近7天'
),
(
'1'
,
u
'最近15天'
),
(
'2'
,
u
'最近30天'
),
)
def
queryset
(
self
,
request
,
queryset
):
# 当前日期格式
cur_date
=
datetime
.
datetime
.
now
().
date
()
if
self
.
value
()
==
'0'
:
# 前一天日期
day
=
cur_date
-
datetime
.
timedelta
(
days
=
1
)
return
queryset
.
filter
(
birthday__gte
=
day
)
if
self
.
value
()
==
'1'
:
day
=
cur_date
-
datetime
.
timedelta
(
days
=
15
)
return
queryset
.
filter
(
birthday__gte
=
day
)
if
self
.
value
()
==
'2'
:
day
=
cur_date
-
datetime
.
timedelta
(
days
=
30
)
return
queryset
.
filter
(
birthday__gte
=
day
)
@
admin
.
register
(
Employe
)
class
EmployeAdmin
(
admin
.
ModelAdmin
):
list_display
=
(
'id'
,
'name'
,
'gender'
,
'idCard'
,
'phone'
,
'birthday'
,
'department'
,
'enable'
,
'create_time'
)
search_fields
=
(
'name'
,
'enable'
)
list_per_page
=
10
raw_id_fields
=
(
'department'
,
'title'
)
list_filter
=
(
'department'
,
'create_time'
,
'birthday'
,
'time'
,
'enable'
,
'gender'
)
list_filter
=
(
'department'
,
AgeListFilter
)
# list_filter = (AgeListFilter, 'department', 'create_time', 'birthday', 'time', 'enable', 'gender')
list_display_links
=
(
'name'
,
'idCard'
)
...
...
simpleui_demo/settings.py
浏览文件 @
96547a62
...
...
@@ -136,6 +136,9 @@ STATIC_ROOT = os.path.join(BASE_DIR, "static")
# 首页图标,支持element-ui的图标和fontawesome的图标
# SIMPLEUI_HOME_ICON = 'el-icon-date'
# 设置simpleui 点击首页图标跳转的地址
SIMPLEUI_INDEX
=
'https://www.88cto.com'
# 首页显示服务器、python、django、simpleui相关信息
# SIMPLEUI_HOME_INFO = False
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录