Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_45031851
simpleui_demo
提交
7060b109
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 搜索 >>
提交
7060b109
编写于
5月 20, 2019
作者:
N
newpanjing
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
功能增加
上级
5fd2310a
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
65 addition
and
32 deletion
+65
-32
db.sqlite3
db.sqlite3
+0
-0
demo/admin.py
demo/admin.py
+15
-0
demo/models.py
demo/models.py
+19
-1
simpleui_demo/settings.py
simpleui_demo/settings.py
+31
-31
未找到文件。
db.sqlite3
浏览文件 @
7060b109
无法预览此类型文件
demo/admin.py
浏览文件 @
7060b109
from
django.contrib
import
admin
from
django.contrib
import
admin
from
django.urls
import
reverse
from
.models
import
*
from
.models
import
*
...
@@ -17,6 +19,19 @@ class DepartmentAdmin(admin.ModelAdmin):
...
@@ -17,6 +19,19 @@ class DepartmentAdmin(admin.ModelAdmin):
actions_on_top
=
True
actions_on_top
=
True
@
admin
.
register
(
Title
)
class
TitleAdmin
(
admin
.
ModelAdmin
):
# 要显示的字段
list_display
=
(
'id'
,
'name'
)
# 需要搜索的字段
search_fields
=
(
'name'
,)
# 分页显示,一页的数量
list_per_page
=
10
@
admin
.
register
(
Employe
)
@
admin
.
register
(
Employe
)
class
EmployeAdmin
(
admin
.
ModelAdmin
):
class
EmployeAdmin
(
admin
.
ModelAdmin
):
list_display
=
(
'id'
,
'name'
,
'gender'
,
'idCard'
,
'phone'
,
'birthday'
,
'department'
,
'enable'
,
'create_time'
)
list_display
=
(
'id'
,
'name'
,
'gender'
,
'idCard'
,
'phone'
,
'birthday'
,
'department'
,
'enable'
,
'create_time'
)
...
...
demo/models.py
浏览文件 @
7060b109
from
django.db
import
models
from
django.db
import
models
# Create your models here.
# Create your models here.
from
django.urls
import
reverse
class
Department
(
models
.
Model
):
class
Department
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
128
,
verbose_name
=
'部门名'
,
help_text
=
'一个部门的名字应该唯一'
,
unique
=
True
,
db_index
=
True
)
name
=
models
.
CharField
(
max_length
=
128
,
verbose_name
=
'部门名'
,
help_text
=
'一个部门的名字应该唯一'
,
unique
=
True
,
db_index
=
True
)
...
@@ -15,6 +16,20 @@ class Department(models.Model):
...
@@ -15,6 +16,20 @@ class Department(models.Model):
return
self
.
name
return
self
.
name
class
Title
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
128
,
verbose_name
=
'职务'
,
null
=
True
,
blank
=
True
)
class
Meta
:
verbose_name
=
'职务'
verbose_name_plural
=
'职务管理'
def
get_absolute_url
(
self
):
return
reverse
(
'title-detail-view'
,
args
=
(
self
.
name
,))
def
__str__
(
self
):
return
self
.
name
class
Employe
(
models
.
Model
):
class
Employe
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
128
,
verbose_name
=
'名称'
,
help_text
=
'员工的名字'
,
null
=
False
,
blank
=
False
,
name
=
models
.
CharField
(
max_length
=
128
,
verbose_name
=
'名称'
,
help_text
=
'员工的名字'
,
null
=
False
,
blank
=
False
,
db_index
=
True
)
db_index
=
True
)
...
@@ -36,6 +51,9 @@ class Employe(models.Model):
...
@@ -36,6 +51,9 @@ class Employe(models.Model):
department
=
models
.
ForeignKey
(
Department
,
on_delete
=
models
.
SET_NULL
,
blank
=
False
,
null
=
True
,
verbose_name
=
'部门'
,
department
=
models
.
ForeignKey
(
Department
,
on_delete
=
models
.
SET_NULL
,
blank
=
False
,
null
=
True
,
verbose_name
=
'部门'
,
db_index
=
True
)
db_index
=
True
)
title
=
models
.
ForeignKey
(
Title
,
on_delete
=
models
.
SET_NULL
,
blank
=
False
,
null
=
True
,
verbose_name
=
'职务'
,
db_index
=
True
)
enable
=
models
.
BooleanField
(
verbose_name
=
'状态'
,
default
=
True
)
enable
=
models
.
BooleanField
(
verbose_name
=
'状态'
,
default
=
True
)
create_time
=
models
.
DateTimeField
(
verbose_name
=
'创建时间'
,
auto_now
=
True
)
create_time
=
models
.
DateTimeField
(
verbose_name
=
'创建时间'
,
auto_now
=
True
)
...
...
simpleui_demo/settings.py
浏览文件 @
7060b109
...
@@ -29,8 +29,8 @@ ALLOWED_HOSTS = ['*', ]
...
@@ -29,8 +29,8 @@ ALLOWED_HOSTS = ['*', ]
# Application definition
# Application definition
INSTALLED_APPS
=
[
INSTALLED_APPS
=
[
'import_export'
,
'simpleui'
,
'simpleui'
,
'import_export'
,
'django.contrib.admin'
,
'django.contrib.admin'
,
'django.contrib.auth'
,
'django.contrib.auth'
,
'django.contrib.contenttypes'
,
'django.contrib.contenttypes'
,
...
@@ -153,36 +153,36 @@ STATIC_ROOT = os.path.join(BASE_DIR, "static")
...
@@ -153,36 +153,36 @@ STATIC_ROOT = os.path.join(BASE_DIR, "static")
SIMPLEUI_ANALYSIS
=
True
SIMPLEUI_ANALYSIS
=
True
# 自定义simpleui 菜单
# 自定义simpleui 菜单
#
SIMPLEUI_CONFIG = {
SIMPLEUI_CONFIG
=
{
#
# 在自定义菜单的基础上保留系统模块
# 在自定义菜单的基础上保留系统模块
# 'system_keep': Fals
e,
'system_keep'
:
Tru
e
,
#
'menus': [{
'menus'
:
[{
#
'name': 'Simpleui',
'name'
:
'Simpleui'
,
#
'icon': 'fas fa-code',
'icon'
:
'fas fa-code'
,
#
'url': 'https://gitee.com/tompeppa/simpleui'
'url'
:
'https://gitee.com/tompeppa/simpleui'
#
}, {
},
{
#
'app': 'auth',
'app'
:
'auth'
,
#
'name': '权限认证',
'name'
:
'权限认证'
,
#
'icon': 'fas fa-user-shield',
'icon'
:
'fas fa-user-shield'
,
#
'models': [{
'models'
:
[{
#
'name': '用户',
'name'
:
'用户'
,
#
'icon': 'fa fa-user',
'icon'
:
'fa fa-user'
,
#
'url': 'auth/user/'
'url'
:
'auth/user/'
#
}]
}]
#
}, {
},
{
#
'name': '测试',
'name'
:
'测试'
,
#
'icon': 'fa fa-file',
'icon'
:
'fa fa-file'
,
#
'models': [{
'models'
:
[{
#
'name': 'Baidu',
'name'
:
'Baidu'
,
#
'url': 'http://baidu.com',
'url'
:
'http://baidu.com'
,
#
'icon': 'far fa-surprise'
'icon'
:
'far fa-surprise'
#
}, {
},
{
#
'name': '内网穿透',
'name'
:
'内网穿透'
,
#
'url': 'https://www.wezoz.com',
'url'
:
'https://www.wezoz.com'
,
#
'icon': 'fab fa-github'
'icon'
:
'fab fa-github'
#
}]
}]
#
}]
}]
#
}
}
# 是否显示默认图标,默认=True
# 是否显示默认图标,默认=True
# SIMPLEUI_DEFAULT_ICON = False
# SIMPLEUI_DEFAULT_ICON = False
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录