Skip to content

Commit

Permalink
权限分配优化
Browse files Browse the repository at this point in the history
  • Loading branch information
wkunzhi committed Dec 6, 2019
1 parent 4a5438d commit 08ae9cd
Show file tree
Hide file tree
Showing 8 changed files with 375 additions and 233 deletions.
222 changes: 131 additions & 91 deletions .idea/workspace.xml

Large diffs are not rendered by default.

Binary file modified rbac/forms/__pycache__/role.cpython-37.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion rbac/forms/role.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ class Meta:

# 调用bootCSS 给加上class=''即可 自定义样式!
widgets = {
'title': forms.TextInput(attrs={'class': 'form-control'})
'title': forms.TextInput(attrs={'class': 'layui-input'})
}
27 changes: 15 additions & 12 deletions rbac/templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@
}

.pg-body {
overflow: hidden;
height: calc(100vh - 60px);
}

.left-menu {
float: left;
min-height: 100%;
width: 200px;
height: 100%;
overflow: auto;
}

.layui-header a {
text-decoration: none;
}
Expand All @@ -42,20 +45,18 @@
}

.pg-body, .left-menu, .left-tree {
{#height: 100%;#}
{#height: 100%;#} background-color: #272a33;
}

.pg-body > .right-body {
box-sizing: border-box;
background-color: #f2f2f2;
float: left;
width: calc(100% - 202px);
{#position: absolute;#}
{#left: 200px;#}
{#right: 0;#}
{#top: 60px;#}
border: 1px solid #ddd;
height: 100%;
width: calc(100% - 200px);
{#position: absolute;#} border: 1px solid #ddd;
font-size: 14px;
{#min-width: 755px;#}
overflow: auto;
}

.layui-card-one {
Expand Down Expand Up @@ -116,14 +117,16 @@
<div class="left-menu">
<div class="menu-body">
{% multi_menu request %}
</div>
</div>
</div>
<!--右侧-->
<div class="right-body">
<div class="layui-card-one">
{% breadcrumb request %}
</div>
{% block content %} {% endblock %}
<div class="right-t-body">
{% block content %} {% endblock %}
</div>
</div>
</div>
<script src="{% static 'js/jquery-3.3.1.min.js' %} "></script>
Expand Down
283 changes: 190 additions & 93 deletions rbac/templates/rbac/distribute_permissions.html

Large diffs are not rendered by default.

73 changes: 37 additions & 36 deletions rbac/templates/rbac/role_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,44 @@


{% block content %}

<div class="luffy-container">
<div class="btn-group" style="margin: 5px 0">
<!--因为rbac的urls有上级urls所以 ,反向生成url的方法如下-->
<a class="btn btn-default" href="{% url 'rbac:role_add' %}"> <!--反向生成url-->
<i class="fa fa-plus-square" aria-hidden="true"></i> 添加角色
</a>


<div class="layui-row">
<div class="layui-card layui-col-md6" style="margin: 20px">
<div class="layui-card-header">角色管理
<div style="float: right;">
<!--因为rbac的urls有上级urls所以 ,反向生成url的方法如下-->
<a class="layui-btn layui-btn-sm" href="{% url 'rbac:role_add' %}"> <!--反向生成url-->
<i class="fa fa-plus-square" aria-hidden="true"></i> 添加角色
</a>
</div>
</div>
<div class="layui-card-body" style="padding: 0">
<table class="layui-table" style="margin: 0;">
<thead>
<tr style="background-color: #00968817">
<th>ID</th>
<th>名称</th>
<th>选项</th>
</tr>
</thead>
<tbody>
{% for row in roles %}
<tr>
<td>{{ row.id }}</td>
<td>{{ row.title }}</td>
<td>
<a style="color: #333333;" href="{% url 'rbac:role_edit' pk=row.id %}">
<!--反向取url 带参数pk-->
<i class="fa fa-edit" aria-hidden="true"></i></a>

<a style="color: #d9534f;" href="{% url 'rbac:role_del' pk=row.id %}"><i
class="fa fa-trash-o"></i></a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<table class="table table-bordered table-hover">
<thead>
<tr>
<th>ID</th>
<th>名称</th>
<th>选项</th>


</tr>
</thead>
<tbody>
{% for row in roles %}
<tr>
<td>{{ row.id }}</td>
<td>{{ row.title }}</td>
<td>
<a style="color: #333333;" href="{% url 'rbac:role_edit' pk=row.id %}"> <!--反向取url 带参数pk-->
<i class="fa fa-edit" aria-hidden="true"></i></a>

<a style="color: #d9534f;" href="{% url 'rbac:role_del' pk=row.id %}"><i
class="fa fa-trash-o"></i></a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>


{% endblock %}
Binary file modified rbac/views/__pycache__/menu.cpython-37.pyc
Binary file not shown.
1 change: 1 addition & 0 deletions rbac/views/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ def distribute_permissions(request):
:param request:
:return:
"""
print(request.POST)
# 取业务中的用户表(因为设计成了可插拔式)
user_model_class = import_string(settings.RBAC_USER_MODEL_CLASS)

Expand Down

0 comments on commit 08ae9cd

Please sign in to comment.