rbac config

This commit is contained in:
RobbieHan
2018-11-16 20:15:05 +08:00
parent 1f94ffa857
commit e2edef0af2
22 changed files with 477 additions and 278 deletions

515
.idea/workspace.xml generated
View File

@@ -2,10 +2,19 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="80da5b45-7eca-459a-bbe3-5443bc141768" name="Default" comment="">
<change beforePath="$PROJECT_DIR$/apps/system/urls.py" afterPath="$PROJECT_DIR$/apps/system/urls.py" />
<change beforePath="$PROJECT_DIR$/apps/system/views_role.py" afterPath="$PROJECT_DIR$/apps/system/views_role.py" />
<change beforePath="" afterPath="$PROJECT_DIR$/apps/system/migrations/0002_auto_20181115_2124.py" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change beforePath="$PROJECT_DIR$/apps/system/models.py" afterPath="$PROJECT_DIR$/apps/system/models.py" />
<change beforePath="$PROJECT_DIR$/apps/system/views_menu.py" afterPath="$PROJECT_DIR$/apps/system/views_menu.py" />
<change beforePath="$PROJECT_DIR$/db.sqlite3" afterPath="$PROJECT_DIR$/db.sqlite3" />
<change beforePath="$PROJECT_DIR$/sandboxMP/settings.py" afterPath="$PROJECT_DIR$/sandboxMP/settings.py" />
<change beforePath="$PROJECT_DIR$/templates/base-left.html" afterPath="$PROJECT_DIR$/templates/base-left.html" />
<change beforePath="$PROJECT_DIR$/templates/head-footer.html" afterPath="$PROJECT_DIR$/templates/head-footer.html" />
<change beforePath="$PROJECT_DIR$/templates/system/menu_form.html" afterPath="$PROJECT_DIR$/templates/system/menu_form.html" />
<change beforePath="$PROJECT_DIR$/templates/system/menu_update.html" afterPath="$PROJECT_DIR$/templates/system/menu_update.html" />
<change beforePath="$PROJECT_DIR$/templates/system/role.html" afterPath="$PROJECT_DIR$/templates/system/role.html" />
<change beforePath="$PROJECT_DIR$/templates/system/structure/structure.html" afterPath="$PROJECT_DIR$/templates/system/structure/structure.html" />
<change beforePath="$PROJECT_DIR$/templates/system/users/user.html" afterPath="$PROJECT_DIR$/templates/system/users/user.html" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" />
@@ -19,69 +28,63 @@
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file leaf-file-name="urls.py" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/apps/system/urls.py">
<file leaf-file-name="settings.py" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/sandboxMP/settings.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="601">
<caret line="38" column="0" lean-forward="true" selection-start-line="38" selection-start-column="0" selection-end-line="38" selection-end-column="0" />
<state relative-caret-position="293">
<caret line="57" column="0" lean-forward="false" selection-start-line="57" selection-start-column="0" selection-end-line="57" selection-end-column="0" />
<folding>
<element signature="e#0#28#0" expanded="true" />
<element signature="e#310#319#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="role_role2menu.html" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/templates/system/role_role2menu.html">
<file leaf-file-name="head-footer.html" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/templates/head-footer.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2097">
<caret line="177" column="13" lean-forward="true" selection-start-line="177" selection-start-column="13" selection-end-line="177" selection-end-column="13" />
<folding>
<element signature="e#1424#1456#0#HTML" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="custom.py" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/apps/custom.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="221">
<caret line="13" column="28" lean-forward="false" selection-start-line="13" selection-start-column="28" selection-end-line="13" selection-end-column="28" />
<folding>
<element signature="e#73#84#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="models.py" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/apps/system/models.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="404">
<caret line="32" column="84" lean-forward="false" selection-start-line="32" selection-start-column="84" selection-end-line="32" selection-end-column="84" />
<state relative-caret-position="306">
<caret line="18" column="85" lean-forward="false" selection-start-line="18" selection-start-column="85" selection-end-line="18" selection-end-column="85" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="views_role.py" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/apps/system/views_role.py">
<file leaf-file-name="base-left.html" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/templates/base-left.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="414">
<caret line="92" column="32" lean-forward="true" selection-start-line="92" selection-start-column="32" selection-end-line="92" selection-end-column="32" />
<folding>
<element signature="e#78#89#0" expanded="true" />
</folding>
<state relative-caret-position="187">
<caret line="23" column="30" lean-forward="true" selection-start-line="23" selection-start-column="30" selection-end-line="23" selection-end-column="30" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="role.html" pinned="false" current-in-tab="true">
<file leaf-file-name="role.html" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/templates/system/role.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="217">
<caret line="229" column="25" lean-forward="false" selection-start-line="229" selection-start-column="13" selection-end-line="229" selection-end-column="25" />
<state relative-caret-position="540">
<caret line="71" column="19" lean-forward="false" selection-start-line="71" selection-start-column="19" selection-end-line="71" selection-end-column="19" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="structure.html" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/templates/system/structure/structure.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="310">
<caret line="59" column="0" lean-forward="false" selection-start-line="59" selection-start-column="0" selection-end-line="65" selection-end-column="9" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="user.html" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/templates/system/users/user.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="330">
<caret line="90" column="0" lean-forward="false" selection-start-line="90" selection-start-column="0" selection-end-line="96" selection-end-column="9" />
<folding />
</state>
</provider>
@@ -92,8 +95,8 @@
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Python Script" />
<option value="HTML File" />
<option value="Python Script" />
</list>
</option>
</component>
@@ -109,9 +112,6 @@
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/templates/base-left.html" />
<option value="$PROJECT_DIR$/templates/head-footer.html" />
<option value="$PROJECT_DIR$/apps/system/models.py" />
<option value="$PROJECT_DIR$/apps/system/mixin.py" />
<option value="$PROJECT_DIR$/templates/system/system.html" />
<option value="$PROJECT_DIR$/sandboxMP/urls.py" />
@@ -121,31 +121,37 @@
<option value="$PROJECT_DIR$/templates/system/structure/structure_create.html" />
<option value="$PROJECT_DIR$/templates/system/structure/strueture_users.html" />
<option value="$PROJECT_DIR$/templates/system/structure/strueture_user.html" />
<option value="$PROJECT_DIR$/templates/system/structure/structure.html" />
<option value="$PROJECT_DIR$/templates/system/structure/structure_user.html" />
<option value="$PROJECT_DIR$/templates/system/users/user_create.html" />
<option value="$PROJECT_DIR$/templates/system/users/user_detail.html" />
<option value="$PROJECT_DIR$/templates/base-static.html" />
<option value="$PROJECT_DIR$/templates/system/users/passwd_change.html" />
<option value="$PROJECT_DIR$/templates/system/users/user.html" />
<option value="$PROJECT_DIR$/apps/system/views_user.py" />
<option value="$PROJECT_DIR$/apps/system/forms.py" />
<option value="$PROJECT_DIR$/apps/system/views.menu.py" />
<option value="$PROJECT_DIR$/templates/system/menu_form.html" />
<option value="$PROJECT_DIR$/apps/system/apps.py" />
<option value="$PROJECT_DIR$/sandboxMP/settings.py" />
<option value="$PROJECT_DIR$/apps/system/views_structure.py" />
<option value="$PROJECT_DIR$/templates/system/menu_update.html" />
<option value="$PROJECT_DIR$/templates/system/menu_list.html" />
<option value="$PROJECT_DIR$/templates/system/role_create.html" />
<option value="$PROJECT_DIR$/apps/system/views_menu.py" />
<option value="$PROJECT_DIR$/templates/system/role_update.html" />
<option value="$PROJECT_DIR$/apps/custom.py" />
<option value="$PROJECT_DIR$/templates/system/role_role2user.html" />
<option value="$PROJECT_DIR$/apps/system/views_role.py" />
<option value="$PROJECT_DIR$/templates/system/role_role2menu.html" />
<option value="$PROJECT_DIR$/apps/system/urls.py" />
<option value="$PROJECT_DIR$/apps/system/views_menu.py" />
<option value="$PROJECT_DIR$/apps/system/models.py" />
<option value="$PROJECT_DIR$/templates/system/menu_form.html" />
<option value="$PROJECT_DIR$/templates/system/menu_update.html" />
<option value="$PROJECT_DIR$/apps/system/milddleware.py" />
<option value="$PROJECT_DIR$/apps/milddleware.py" />
<option value="$PROJECT_DIR$/templates/head-footer.html" />
<option value="$PROJECT_DIR$/templates/base-left.html" />
<option value="$PROJECT_DIR$/templates/system/structure/structure.html" />
<option value="$PROJECT_DIR$/templates/system/users/user.html" />
<option value="$PROJECT_DIR$/templates/system/role.html" />
<option value="$PROJECT_DIR$/sandboxMP/settings.py" />
<option value="$PROJECT_DIR$/apps/system/middleware.py" />
</list>
</option>
</component>
@@ -193,7 +199,6 @@
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scratches" />
<pane id="ProjectPane">
<subPane>
<expand>
@@ -211,23 +216,18 @@
<item name="sandboxMP" type="462c0819:PsiDirectoryNode" />
<item name="templates" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="sandboxMP" type="b2602c69:ProjectViewProjectNode" />
<item name="sandboxMP" type="462c0819:PsiDirectoryNode" />
<item name="templates" type="462c0819:PsiDirectoryNode" />
<item name="system" type="462c0819:PsiDirectoryNode" />
</path>
</expand>
<select />
</subPane>
</pane>
<pane id="Scratches" />
<pane id="Scope" />
</panes>
</component>
<component name="PropertiesComponent">
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
<property name="settings.editor.selected.configurable" value="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="last_opened_file_path" value="D:/PycharmProject/sandboxOA" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="DefaultHtmlFileTemplate" value="HTML File" />
</component>
@@ -239,6 +239,10 @@
</option>
</component>
<component name="RecentsManager">
<key name="MoveFile.RECENT_KEYS">
<recent name="D:\ProjectFile\sandboxMP\apps" />
<recent name="D:\ProjectFile\sandboxMP\templates\system" />
</key>
<key name="CopyFile.RECENT_KEYS">
<recent name="D:\ProjectFile\sandboxMP\templates\system" />
<recent name="D:\ProjectFile\sandboxMP\templates" />
@@ -246,10 +250,6 @@
<recent name="D:\ProjectFile\sandboxMP\templates\system\structure" />
<recent name="D:\ProjectFile\sandboxMP\apps\system" />
</key>
<key name="MoveFile.RECENT_KEYS">
<recent name="D:\ProjectFile\sandboxMP\templates\system" />
<recent name="D:\ProjectFile\sandboxMP\apps" />
</key>
</component>
<component name="RunDashboard">
<option name="ruleStates">
@@ -315,43 +315,30 @@
</component>
<component name="ToolWindowManager">
<frame x="-1448" y="-8" width="1456" height="876" extended-state="6" />
<editor active="true" />
<layout>
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32882273" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.24156693" sideWeight="0.5042644" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.270636" sideWeight="0.49573562" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32882273" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Python Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32882273" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Mongo Explorer" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.21380244" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.20558739" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Docker" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="SciView" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.18656716" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.21650879" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3297062" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.24156693" sideWeight="0.5042644" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.12948857" sideWeight="0.49573562" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.2232747" sideWeight="0.49573562" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3297062" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Python Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3297062" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="manage.py@sandboxMP" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.28073993" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
<window_info id="Mongo Explorer" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3297062" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.20095949" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.27005732" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Docker" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="SciView" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.18656716" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.21650879" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.28281462" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="manage.py@sandboxMP" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.34912044" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
</layout>
</component>
<component name="TypeScriptGeneratedFilesManager">
@@ -362,75 +349,18 @@
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<option name="time" value="24" />
<default-breakpoints>
<breakpoint type="python-exception">
<properties notifyOnTerminate="true" exception="BaseException">
<option name="notifyOnTerminate" value="true" />
</properties>
</breakpoint>
</default-breakpoints>
<option name="time" value="38" />
</breakpoint-manager>
<watches-manager />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/templates/base-left.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="483">
<caret line="36" column="13" lean-forward="true" selection-start-line="36" selection-start-column="13" selection-end-line="36" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/apps/system/views.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="153">
<caret line="9" column="58" lean-forward="true" selection-start-line="9" selection-start-column="58" selection-end-line="9" selection-end-column="58" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/templates/system/system_index.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="204">
<caret line="12" column="0" lean-forward="true" selection-start-line="12" selection-start-column="0" selection-end-line="12" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/Envs/sandboxMP/Lib/site-packages/django/urls/conf.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="68">
<caret line="11" column="15" lean-forward="true" selection-start-line="11" selection-start-column="15" selection-end-line="11" selection-end-column="15" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/apps/system/tests.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="51">
<caret line="3" column="0" lean-forward="false" selection-start-line="3" selection-start-column="0" selection-end-line="3" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/apps/__init__.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/Envs/sandboxMP/Lib/site-packages/braces/views/_ajax.py" />
<entry file="file://$PROJECT_DIR$/templates/system/structure/structure_create.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="524">
<caret line="89" column="11" lean-forward="true" selection-start-line="89" selection-start-column="11" selection-end-line="89" selection-end-column="11" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/templates/system/structure/structure_user.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-15">
<caret line="29" column="95" lean-forward="true" selection-start-line="29" selection-start-column="95" selection-end-line="29" selection-end-column="95" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/templates/system/structure/structure.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="836">
<caret line="238" column="22" lean-forward="false" selection-start-line="238" selection-start-column="22" selection-end-line="238" selection-end-column="22" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/static/plugins/datatables/dataTables.const-1.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="68">
@@ -452,14 +382,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/templates/head-footer.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1598">
<caret line="94" column="22" lean-forward="true" selection-start-line="94" selection-start-column="22" selection-end-line="94" selection-end-column="22" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/templates/base-static.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="238">
@@ -544,14 +466,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/templates/system/users/user.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="500">
<caret line="67" column="35" lean-forward="true" selection-start-line="67" selection-start-column="35" selection-end-line="67" selection-end-column="35" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/templates/system/users/login.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="170">
@@ -576,14 +490,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/apps/system/mixin.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="119">
<caret line="7" column="6" lean-forward="false" selection-start-line="7" selection-start-column="6" selection-end-line="7" selection-end-column="6" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/apps/system/views_user.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-815">
@@ -601,22 +507,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/sandboxMP/settings.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="221">
<caret line="56" column="38" lean-forward="true" selection-start-line="56" selection-start-column="38" selection-end-line="56" selection-end-column="38" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/templates/system/menu_form.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1122">
<caret line="66" column="49" lean-forward="false" selection-start-line="66" selection-start-column="49" selection-end-line="66" selection-end-column="49" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/Envs/sandboxMP/Lib/site-packages/django/views/generic/base.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="197">
@@ -649,14 +539,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/templates/system/menu_list.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="606">
<caret line="160" column="11" lean-forward="true" selection-start-line="160" selection-start-column="11" selection-end-line="160" selection-end-column="11" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/templates/system/role_update.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="657">
@@ -702,24 +584,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/apps/system/views_menu.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="391">
<caret line="23" column="0" lean-forward="true" selection-start-line="23" selection-start-column="0" selection-end-line="23" selection-end-column="0" />
<folding>
<element signature="e#0#41#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/templates/system/menu_update.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="223">
<caret line="75" column="26" lean-forward="false" selection-start-line="75" selection-start-column="26" selection-end-line="75" selection-end-column="26" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/templates/system/role_role2user.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="563">
@@ -728,58 +592,199 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/apps/system/urls.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="601">
<caret line="38" column="0" lean-forward="true" selection-start-line="38" selection-start-column="0" selection-end-line="38" selection-end-column="0" />
<folding>
<element signature="e#0#28#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/apps/custom.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="221">
<caret line="13" column="28" lean-forward="false" selection-start-line="13" selection-start-column="28" selection-end-line="13" selection-end-column="28" />
<folding>
<element signature="e#73#84#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/templates/system/role_role2menu.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2097">
<caret line="177" column="13" lean-forward="true" selection-start-line="177" selection-start-column="13" selection-end-line="177" selection-end-column="13" />
<folding>
<element signature="e#1424#1456#0#HTML" expanded="true" />
<element signature="e#1424#1456#0#HTML" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/apps/system/models.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="404">
<caret line="32" column="84" lean-forward="false" selection-start-line="32" selection-start-column="84" selection-end-line="32" selection-end-column="84" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/apps/system/views_role.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="414">
<caret line="92" column="32" lean-forward="true" selection-start-line="92" selection-start-column="32" selection-end-line="92" selection-end-column="32" />
<folding>
<element signature="e#78#89#0" expanded="true" />
<element signature="e#78#89#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/apps/system/views_menu.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="493">
<caret line="29" column="0" lean-forward="true" selection-start-line="29" selection-start-column="0" selection-end-line="29" selection-end-column="0" />
<folding>
<element signature="e#0#41#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/apps/custom.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="672">
<caret line="57" column="0" lean-forward="false" selection-start-line="57" selection-start-column="0" selection-end-line="57" selection-end-column="0" />
<folding>
<element signature="e#73#84#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/templates/system/menu_update.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="153">
<caret line="48" column="11" lean-forward="false" selection-start-line="48" selection-start-column="11" selection-end-line="48" selection-end-column="11" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/apps/system/urls.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="510">
<caret line="30" column="92" lean-forward="true" selection-start-line="30" selection-start-column="92" selection-end-line="30" selection-end-column="92" />
<folding>
<element signature="e#0#28#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/Envs/sandboxMP/Lib/site-packages/django/core/servers/basehttp.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="401">
<caret line="58" column="0" lean-forward="true" selection-start-line="58" selection-start-column="0" selection-end-line="58" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/sandboxMP/wsgi.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="187">
<caret line="11" column="49" lean-forward="true" selection-start-line="11" selection-start-column="49" selection-end-line="11" selection-end-column="49" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/apps/milddleware.py" />
<entry file="file://$PROJECT_DIR$/apps/system/mixin.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="187">
<caret line="11" column="35" lean-forward="true" selection-start-line="11" selection-start-column="35" selection-end-line="11" selection-end-column="35" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/Envs/sandboxMP/Lib/site-packages/django/utils/module_loading.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="221">
<caret line="16" column="0" lean-forward="false" selection-start-line="16" selection-start-column="0" selection-end-line="16" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/Envs/sandboxMP/Lib/importlib/__init__.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="231">
<caret line="125" column="0" lean-forward="false" selection-start-line="125" selection-start-column="0" selection-end-line="125" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/Envs/sandboxMP/Lib/site-packages/django/core/handlers/exception.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="340">
<caret line="34" column="0" lean-forward="false" selection-start-line="34" selection-start-column="0" selection-end-line="34" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/Envs/sandboxMP/Lib/site-packages/django/utils/deprecation.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="497">
<caret line="89" column="0" lean-forward="false" selection-start-line="89" selection-start-column="0" selection-end-line="89" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/templates/system/menu_form.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="310">
<caret line="51" column="26" lean-forward="false" selection-start-line="51" selection-start-column="26" selection-end-line="51" selection-end-column="26" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/templates/system/menu_list.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="204">
<caret line="60" column="0" lean-forward="false" selection-start-line="60" selection-start-column="0" selection-end-line="66" selection-end-column="13" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/apps/system/models.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="17">
<caret line="28" column="16" lean-forward="false" selection-start-line="28" selection-start-column="16" selection-end-line="28" selection-end-column="16" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/templates/system/users/user.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="330">
<caret line="90" column="0" lean-forward="false" selection-start-line="90" selection-start-column="0" selection-end-line="96" selection-end-column="9" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/templates/system/role.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="217">
<caret line="229" column="25" lean-forward="false" selection-start-line="229" selection-start-column="13" selection-end-line="229" selection-end-column="25" />
<state relative-caret-position="540">
<caret line="71" column="19" lean-forward="false" selection-start-line="71" selection-start-column="19" selection-end-line="71" selection-end-column="19" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/templates/system/structure/structure.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="310">
<caret line="59" column="0" lean-forward="false" selection-start-line="59" selection-start-column="0" selection-end-line="65" selection-end-column="9" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/apps/system/middleware.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="536">
<caret line="96" column="45" lean-forward="true" selection-start-line="96" selection-start-column="45" selection-end-line="96" selection-end-column="45" />
<folding>
<element signature="e#0#9#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/sandboxMP/settings.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="293">
<caret line="57" column="0" lean-forward="false" selection-start-line="57" selection-start-column="0" selection-end-line="57" selection-end-column="0" />
<folding>
<element signature="e#310#319#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/templates/head-footer.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="306">
<caret line="18" column="85" lean-forward="false" selection-start-line="18" selection-start-column="85" selection-end-line="18" selection-end-column="85" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/templates/base-left.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="187">
<caret line="23" column="30" lean-forward="true" selection-start-line="23" selection-start-column="30" selection-end-line="23" selection-end-column="30" />
<folding />
</state>
</provider>

Binary file not shown.

100
apps/system/middleware.py Normal file
View File

@@ -0,0 +1,100 @@
import re
from django.utils.deprecation import MiddlewareMixin
from django.conf import settings
from django.shortcuts import render
class MenuCollection(MiddlewareMixin):
def get_user(self, request):
return request.user
def get_menu_from_role(self, request, user=None):
if user is None:
user = self.get_user(request)
try:
menus = user.roles.values(
'permissions__id',
'permissions__name',
'permissions__url',
'permissions__icon',
'permissions__code',
'permissions__parent'
).distinct()
return [menu for menu in menus if menu['permissions__id'] is not None]
except AttributeError:
return None
def get_permission_url(self, request):
role_menus = self.get_menu_from_role(request)
if role_menus is not None:
permission_url_list = [menu['permissions__url'] for menu in role_menus]
return permission_url_list
def get_permission_menu(self, request):
permission_menu_list = []
role_menus = self.get_menu_from_role(request)
if role_menus is not None:
for item in role_menus:
menu = {
'id': item['permissions__id'],
'name': item['permissions__name'],
'url': item['permissions__url'],
'icon': item['permissions__icon'],
'code': item['permissions__code'],
'parent': item['permissions__parent'],
'status': False,
'sub_menu': [],
}
permission_menu_list.append(menu)
return permission_menu_list
def get_top_reveal_menu(self, request):
top_menu = []
permission_menu_dict = {}
request_url = request.path_info
permission_menu_list = self.get_permission_menu(request)
if permission_menu_list is not None:
for menu in permission_menu_list:
url = menu['url']
if url and re.match(url, request_url):
menu['status'] = True
if menu['parent'] is None:
top_menu.insert(0, menu)
permission_menu_dict[menu['id']] = menu
menu_data = []
for i in permission_menu_dict:
if permission_menu_dict[i]['parent']:
pid = permission_menu_dict[i]['parent']
parent_menu = permission_menu_dict[pid]
parent_menu['sub_menu'].append(permission_menu_dict[i])
else:
menu_data.append(permission_menu_dict[i])
if [menu['sub_menu'] for menu in menu_data if menu['url'] in request_url]:
reveal_menu = [menu['sub_menu'] for menu in menu_data if menu['url'] in request_url][0]
else:
reveal_menu = None
return top_menu, reveal_menu
def process_request(self, request):
if self.get_top_reveal_menu(request):
request.top_menu, request.reveal_menu = self.get_top_reveal_menu(request)
request.permission_url_list = self.get_permission_url(request)
class RbacMiddleware(MiddlewareMixin):
def process_request(self, request):
if hasattr(request, 'permission_url_list'):
request_url = request.path_info
permission_url = request.permission_url_list
for url in settings.SAFE_URL:
if re.match(url, request_url):
return None
if request_url in permission_url:
return None
else:
return render(request, 'page404.html')

View File

@@ -0,0 +1,22 @@
# Generated by Django 2.1.2 on 2018-11-15 21:24
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('system', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
name='menu',
options={'ordering': ['number'], 'verbose_name': '菜单', 'verbose_name_plural': '菜单'},
),
migrations.AddField(
model_name='menu',
name='number',
field=models.FloatField(blank=True, null=True, verbose_name='编号'),
),
]

View File

@@ -11,6 +11,7 @@ class Menu(models.Model):
icon = models.CharField(max_length=50, null=True, blank=True, verbose_name="图标")
code = models.CharField(max_length=50, null=True, blank=True, verbose_name="编码")
url = models.CharField(max_length=128, unique=True, null=True, blank=True)
number = models.FloatField(null=True, blank=True, verbose_name="编号")
def __str__(self):
return self.name
@@ -18,10 +19,14 @@ class Menu(models.Model):
class Meta:
verbose_name = '菜单'
verbose_name_plural = verbose_name
ordering = ['number']
@classmethod
def get_menu_by_request_url(cls, url):
return dict(menu=Menu.objects.get(url=url))
try:
return dict(menu=Menu.objects.get(url=url))
except:
pass
class Role(models.Model):

View File

@@ -8,7 +8,10 @@ from .models import Menu
class MenuCreateView(SandboxCreateView):
model = Menu
fields = '__all__'
extra_context = dict(menu_all=Menu.objects.all())
def get_context_data(self, **kwargs):
kwargs['menu_all'] = Menu.objects.all()
return super().get_context_data(**kwargs)
class MenuListView(LoginRequiredMixin, ListView):
@@ -20,4 +23,7 @@ class MenuUpdateView(SandboxUpdateView):
model = Menu
fields = '__all__'
template_name_suffix = '_update'
extra_context = dict(menu_all=Menu.objects.all())
def get_context_data(self, **kwargs):
kwargs['menu_all'] = Menu.objects.all()
return super().get_context_data(**kwargs)

Binary file not shown.

View File

@@ -50,6 +50,8 @@ MIDDLEWARE = [
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'apps.system.middleware.MenuCollection',
'apps.system.middleware.RbacMiddleware',
]
ROOT_URLCONF = 'sandboxMP.urls'
@@ -132,3 +134,13 @@ MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
LOGIN_URL = '/login/'
# safe url
SAFE_URL = [r'^/$',
'/login/',
'/logout',
'/index/',
'/media/',
'/admin/',
'/ckeditor/',
]

View File

@@ -21,20 +21,32 @@
<!-- /.search form -->
<!-- Sidebar Menu -->
<ul class="sidebar-menu">
<ul class="sidebar-menu">
<li class="header"></li>
<!-- Optionally, you can add icons to the links -->
<li class="treeview">
<a href="#"><i class="fa fa-calendar"></i> <span>一级菜单</span>
<span class="pull-right-container">
<i class="fa fa-angle-left pull-right"></i>
</span>
</a>
<ul class="treeview-menu">
<li><a href="#"><i class="fa fa-caret-right"></i>二级菜单</a></li>
<li><a href="#"><i class="fa fa-caret-right"></i>二级菜单</a></li>
</ul>
</li>
{% for menu in request.reveal_menu %}
{% if not menu.url %}
<li class="treeview" id="{{ menu.code }}">
<a href="">
<i class="{{ menu.icon }}"></i><span>{{ menu.name }}</span>
<span class="pull-right-container"><i class="fa fa-angle-left pull-right"></i>
</span>
</a>
<ul class="treeview-menu">
{% for sub in menu.sub_menu %}
<li id="{{ sub.code }}">
<a href="{{ sub.url }}"><i class="fa fa-caret-right"></i>{{ sub.name }}</a>
</li>
{% endfor %}
</ul>
</li>
{% else %}
<li id="{{ menu.code }}">
<a href="{{ menu.url }}"><i class="{{ menu.icon }}"></i><span>{{ menu.name }}</span>
</a>
</li>
{% endif %}
{% endfor %}
</ul>
<!-- /.sidebar-menu -->
</section>

View File

@@ -20,9 +20,13 @@
<span class="sr-only">Toggle navigation</span>
</a>
<div class="collapse navbar-collapse pull-left" id="navbar-collapse">
<ul class="nav navbar-nav">
<li class="active" ><a href="#" id="index">头部导航</a></li>
</ul>
{% for menu in request.top_menu %}
<ul class="nav navbar-nav">
<li {% ifequal menu.status True %}class="active" {% endifequal %}>
<a href="{{ menu.url }}" id="{{ menu.code }}">{{ menu.name | default_if_none:"" }}</a>
</li>
</ul>
{% endfor %}
</div>
{% if request.user.is_authenticated %}
<div class="navbar-custom-menu">

View File

@@ -18,9 +18,9 @@
<div class="col-sm-3">
<input class="form-control" name="name" type="text"/>
</div>
<label class="col-sm-2 control-label">代码</label>
<label class="col-sm-2 control-label">编号</label>
<div class="col-sm-3">
<input class="form-control" name="code" type="text"/>
<input class="form-control" name="number" type="text"/>
</div>
</div>
<div class="form-group has-feedback">
@@ -43,7 +43,12 @@
<div class="col-sm-8">
<input class="form-control" name="url" type="text" />
</div>
</div>
<div class="form-group has-feedback">
<label class="col-sm-2 control-label">代码</label>
<div class="col-sm-8">
<input class="form-control" name="code" type="text"/>
</div>
</div>
</fieldset>
</div>

View File

@@ -18,9 +18,9 @@
<div class="col-sm-3">
<input class="form-control" name="name" type="text" value="{{ menu.name }}"/>
</div>
<label class="col-sm-2 control-label">代码</label>
<label class="col-sm-2 control-label">编号</label>
<div class="col-sm-3">
<input class="form-control" name="code" type="text" value="{{ menu.code }}"/>
<input class="form-control" name="number" type="text" value="{{ menu.number }}"/>
</div>
</div>
<div class="form-group has-feedback">
@@ -32,6 +32,7 @@
<div class="col-sm-3">
<select class="form-control select2" name="parent">
<option value="{{ menu.parent.id }}">{{ menu.parent.name }}</option>
<option value=""> </option>
{% for parent_menu in menu_all %}
<option value={{ parent_menu.id }}> {{ parent_menu.name }} </option>
{% endfor %}
@@ -44,6 +45,12 @@
<input class="form-control" name="url" type="text" value="{{ menu.url | default:'' }}"/>
</div>
</div>
<div class="form-group has-feedback">
<label class="col-sm-2 control-label">代码</label>
<div class="col-sm-8">
<input class="form-control" name="code" type="text" value="{{ menu.code | default:'' }}"/>
</div>
</div>
</fieldset>
</div>
<div class="box-footer ">

View File

@@ -60,7 +60,13 @@
<script src="{% static 'plugins/datatables/jquery.dataTables.min.js' %}"></script>
<script src="{% static 'plugins/datatables/dataTables.const.js' %}"></script>
<script src="{% static 'js/plugins/layer/layer.js' %}"></script>
<script type="text/javascript">
$(function () {
$('#SYSTEM-RBAC').addClass('active');
$('#SYSTEM-RBAC-ROLE').addClass('active');
});
</script>
<script type="text/javascript">
var oDataTable = null;
$(function () {

View File

@@ -57,6 +57,13 @@
<script src="{% static 'plugins/datatables/dataTables.const.js' %}"></script>
<script src="{% static 'js/plugins/layer/layer.js' %}"></script>
<script type="text/javascript">
$(function () {
$('#SYSTEM-BASIC').addClass('active');
$('#SYSTEM-BASIC-STRUCTURE').addClass('active');
});
</script>
<script type="text/javascript">
var oDataTable = null;
$(function () {

View File

@@ -88,6 +88,14 @@
<script src="{% static 'plugins/datatables/dataTables.const.js' %}"></script>
<script src="{% static 'js/plugins/layer/layer.js' %}"></script>
<script type="text/javascript">
$(function () {
$('#SYSTEM-BASIC').addClass('active');
$('#SYSTEM-BASIC-USER').addClass('active');
});
</script>
<script type="text/javascript">
var oDataTable = null;
$(function () {