Skip to content

Commit

Permalink
system config
Browse files Browse the repository at this point in the history
  • Loading branch information
RobbieHan committed Nov 16, 2018
1 parent e2edef0 commit 0b47673
Show file tree
Hide file tree
Showing 13 changed files with 290 additions and 227 deletions.
386 changes: 177 additions & 209 deletions .idea/workspace.xml

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions apps/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@
from django.http import Http404

from system.mixin import LoginRequiredMixin
from system.models import Menu


class BreadcrumbMixin:

def get_context_data(self, **kwargs):
menu = Menu.get_menu_by_request_url(url=self.request.path_info)
if menu is not None:
kwargs.update(menu)
return super().get_context_data(**kwargs)


class SandboxGetObjectMixin:
Expand Down
2 changes: 1 addition & 1 deletion apps/system/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def get_menu_by_request_url(cls, url):
try:
return dict(menu=Menu.objects.get(url=url))
except:
pass
None


class Role(models.Model):
Expand Down
9 changes: 4 additions & 5 deletions apps/system/views.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
from django.shortcuts import render
from django.views.generic.base import View
from django.views.generic import TemplateView

from .mixin import LoginRequiredMixin
from custom import BreadcrumbMixin


class SystemView(LoginRequiredMixin, View):
class SystemView(LoginRequiredMixin, BreadcrumbMixin, TemplateView):

def get(self, request):
return render(request, 'system/system_index.html')
template_name = 'system/system_index.html'

4 changes: 2 additions & 2 deletions apps/system/views_menu.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django.views.generic import ListView

from .mixin import LoginRequiredMixin
from apps.custom import SandboxCreateView, SandboxUpdateView
from apps.custom import SandboxCreateView, SandboxUpdateView, BreadcrumbMixin
from .models import Menu


Expand All @@ -14,7 +14,7 @@ def get_context_data(self, **kwargs):
return super().get_context_data(**kwargs)


class MenuListView(LoginRequiredMixin, ListView):
class MenuListView(LoginRequiredMixin, BreadcrumbMixin, ListView):
model = Menu
context_object_name = 'menu_all'

Expand Down
4 changes: 2 additions & 2 deletions apps/system/views_role.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@

from .mixin import LoginRequiredMixin
from .models import Role, Menu
from custom import SandboxCreateView, SandboxUpdateView
from custom import SandboxCreateView, SandboxUpdateView, BreadcrumbMixin

User = get_user_model()


class RoleView(LoginRequiredMixin, TemplateView):
class RoleView(LoginRequiredMixin, BreadcrumbMixin, TemplateView):
template_name = 'system/role.html'


Expand Down
3 changes: 2 additions & 1 deletion apps/system/views_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
from .mixin import LoginRequiredMixin
from .models import Structure
from .forms import StructureForm
from apps.custom import BreadcrumbMixin

User = get_user_model()


class StructureView(LoginRequiredMixin, TemplateView):
class StructureView(LoginRequiredMixin, BreadcrumbMixin, TemplateView):

template_name = 'system/structure/structure.html'

Expand Down
3 changes: 2 additions & 1 deletion apps/system/views_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from .forms import LoginForm, UserCreateForm, UserUpdateForm, PasswordChangeForm
from .mixin import LoginRequiredMixin
from .models import Structure, Role
from apps.custom import BreadcrumbMixin

User = get_user_model()

Expand Down Expand Up @@ -63,7 +64,7 @@ def get(self, request):
return HttpResponseRedirect(reverse('login'))


class UserView(LoginRequiredMixin, TemplateView):
class UserView(LoginRequiredMixin, BreadcrumbMixin, TemplateView):
template_name = 'system/users/user.html'


Expand Down
Binary file modified db.sqlite3
Binary file not shown.
2 changes: 2 additions & 0 deletions requirements/dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
django==2.1.2
pillow==5.3.0
2 changes: 2 additions & 0 deletions requirements/pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
django==2.1.2
pillow==5.3.0
9 changes: 8 additions & 1 deletion templates/base-left.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,14 @@

<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">

<section class="content-header margin-bottom">
<ol class="breadcrumb">
{% if menu.parent %}
<li class="active"><a href="{{ menu.parent.url | default:'' }}">{{ menu.parent.name }}</a></li>
{% endif %}
<li class="active"><a href="{{ menu.url }}">{{ menu.name }}</a></li>
</ol>
</section>
{% block content %}


Expand Down
83 changes: 78 additions & 5 deletions templates/system/system_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,87 @@

{% block content %}

<div class="pad margin no-print">
<div class="callout callout-info" style="margin-bottom: 0!important;">
<h4><i class="fa fa-info-circle"></i>系统管理:</h4>
系统管理模块包含:系统权限管理和系统设置,系统权限管理可实现基于角色组的权限管理,可根据角色组权限动态生成URL导航菜单。
</div>
</div>
<!-- Main content -->
<section class="content">
系统管理首页:system_index,content是页面定义的主要区域,
头部和底部内容以及导航栏都是通过模板继承的,之后的所有
功能前端页面都是在content内进行编辑。
</section>
<section class="invoice">
<div class="row">
<div class="col-xs-12">
<h2 class="page-header">
<i class="fa fa-github"></i> RBAC权限管理历史版本
</h2>
</div>
<!-- /.col -->
</div>
<div class="row">

<div class="col-xs-12 table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>编号</th>
<th>TAG</th>
<th>发布日期</th>
<th>TAG地址</th>
<th>Commit</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>v1.19</td>
<td>2018-11-16</td>
<td>https://github.com/RobbieHan/sandboxMP/tree/v1.19</td>
<td>system config</td>
</tr>
<tr>
<td>2</td>
<td>v1.18</td>
<td>2018-11-16</td>
<td>https://github.com/RobbieHan/sandboxMP/tree/v1.18</td>
<td>rbac config</td>
</tr>
<tr>
<td>3</td>
<td>v1.17</td>
<td>2018-11-14</td>
<td>https://github.com/RobbieHan/sandboxMP/tree/v1.17</td>
<td>role2menu</td>
</tr>
<tr>
<td>4</td>
<td>v1.16</td>
<td>2018-11-14</td>
<td>https://github.com/RobbieHan/sandboxMP/tree/v1.17</td>
<td>role2user</td>
</tr>
</tbody>
</table>
</div>
<!-- /.col -->
</div>
<!-- /.row -->
<div class="row">
<!-- accepted payments column -->
<div class="col-xs-12">
<p class="lead">其他信息:</p>

<p class="text-muted well well-sm no-shadow" style="margin-top: 10px;">
<strong>权限管理开发文档获取地址(知识星球):</strong> https://t.zsxq.com/a6IqBMr (微信中打开链接)<br>
<strong>知识星球快捷入口:</strong>微信公众号搜索[知识星球],关注后发送52824366,获取星球连接。<br>
<strong>知乎专栏SandBox:</strong>https://zhuanlan.zhihu.com/sandbox <br>
<strong>轻量级办公管理系统项目开源地址:</strong>https://github.com/RobbieHan/gistandard <br>
</p>
</div>
<!-- /.col -->
</div>
</section>
<!-- /.content -->
<div class="clearfix"></div>

{% endblock %}

Expand Down

0 comments on commit 0b47673

Please sign in to comment.