diff --git "a/DjangoLearning/luffy_permission-\347\251\272\347\231\275\347\211\210/web/templates/menu.html" "b/DjangoLearning/luffy_permission-\347\251\272\347\231\275\347\211\210/web/templates/menu.html"
new file mode 100644
index 0000000000000000000000000000000000000000..2cbdf6f4d0f0d6e5e715673fa94194aff1af34dd
--- /dev/null
+++ "b/DjangoLearning/luffy_permission-\347\251\272\347\231\275\347\211\210/web/templates/menu.html"
@@ -0,0 +1,6 @@
+
\ No newline at end of file
diff --git "a/DjangoLearning/luffy_permission-\347\251\272\347\231\275\347\211\210/web/templatetags/__init__.py" "b/DjangoLearning/luffy_permission-\347\251\272\347\231\275\347\211\210/web/templatetags/__init__.py"
new file mode 100644
index 0000000000000000000000000000000000000000..9169e026eff1b0523f3dcfdf6ea749240198fa4f
--- /dev/null
+++ "b/DjangoLearning/luffy_permission-\347\251\272\347\231\275\347\211\210/web/templatetags/__init__.py"
@@ -0,0 +1,11 @@
+#!/user/bin/env python
+# -*- encoding:utf-8 -*-
+'''
+# @Time : 2019/7/12 19:25
+# @Author : John Wang
+# @Site :
+# @File : __init__.py.py
+# @Software: PyCharm
+# @Contact : 635602689@qq.com
+# @License : (C)Copyright 2019-2020, John Wang
+'''
diff --git "a/DjangoLearning/luffy_permission-\347\251\272\347\231\275\347\211\210/web/templatetags/__pycache__/__init__.cpython-36.pyc" "b/DjangoLearning/luffy_permission-\347\251\272\347\231\275\347\211\210/web/templatetags/__pycache__/__init__.cpython-36.pyc"
new file mode 100644
index 0000000000000000000000000000000000000000..7ab8148e15a3173f39756350eec0b0c0ddbb60e4
Binary files /dev/null and "b/DjangoLearning/luffy_permission-\347\251\272\347\231\275\347\211\210/web/templatetags/__pycache__/__init__.cpython-36.pyc" differ
diff --git "a/DjangoLearning/luffy_permission-\347\251\272\347\231\275\347\211\210/web/templatetags/__pycache__/my_tags.cpython-36.pyc" "b/DjangoLearning/luffy_permission-\347\251\272\347\231\275\347\211\210/web/templatetags/__pycache__/my_tags.cpython-36.pyc"
new file mode 100644
index 0000000000000000000000000000000000000000..95f9fed4cb7d13c1443018e10a5ddf38551fba0b
Binary files /dev/null and "b/DjangoLearning/luffy_permission-\347\251\272\347\231\275\347\211\210/web/templatetags/__pycache__/my_tags.cpython-36.pyc" differ
diff --git "a/DjangoLearning/luffy_permission-\347\251\272\347\231\275\347\211\210/web/templatetags/my_tags.py" "b/DjangoLearning/luffy_permission-\347\251\272\347\231\275\347\211\210/web/templatetags/my_tags.py"
new file mode 100644
index 0000000000000000000000000000000000000000..03793c2624f6268bbb1f8b986429883cd18203c4
--- /dev/null
+++ "b/DjangoLearning/luffy_permission-\347\251\272\347\231\275\347\211\210/web/templatetags/my_tags.py"
@@ -0,0 +1,18 @@
+from django import template
+
+from django.conf import settings
+import re
+
+register = template.Library()
+
+
+@register.inclusion_tag('menu.html')
+def menu(request):
+ menu_list = request.session.get(settings.MENU_SESSION_KEY)
+ print(menu_list)
+ url = request.path_info
+ for i in menu_list:
+ if re.match(r'{}$'.format(i['url']), url):
+ i['class'] = 'active'
+ break
+ return {'menu_list': menu_list}
diff --git "a/DjangoLearning/luffy_permission-\347\251\272\347\231\275\347\211\210/web/views/__pycache__/auth.cpython-36.pyc" "b/DjangoLearning/luffy_permission-\347\251\272\347\231\275\347\211\210/web/views/__pycache__/auth.cpython-36.pyc"
index 5b222d42c8882d281c2d1abd7bd16024df800e5e..9419b79ba54d9b63a848373cf362fd8827842465 100644
Binary files "a/DjangoLearning/luffy_permission-\347\251\272\347\231\275\347\211\210/web/views/__pycache__/auth.cpython-36.pyc" and "b/DjangoLearning/luffy_permission-\347\251\272\347\231\275\347\211\210/web/views/__pycache__/auth.cpython-36.pyc" differ
diff --git "a/DjangoLearning/luffy_permission-\347\251\272\347\231\275\347\211\210/web/views/auth.py" "b/DjangoLearning/luffy_permission-\347\251\272\347\231\275\347\211\210/web/views/auth.py"
index de02322bc0e7063abd03357a2804e98b7f75f72d..d0a65a57fd403de114fd86fe9e0c83ea1121cd41 100644
--- "a/DjangoLearning/luffy_permission-\347\251\272\347\231\275\347\211\210/web/views/auth.py"
+++ "b/DjangoLearning/luffy_permission-\347\251\272\347\231\275\347\211\210/web/views/auth.py"
@@ -1,5 +1,5 @@
from django.shortcuts import render, redirect, reverse
-
+from django.conf import settings
from rbac import models
@@ -30,8 +30,8 @@ def login(request):
'icon': i['permissions__icon'],
})
print(menu_list)
- request.session['permissions'] = permissions_list
- request.session['menus'] = menu_list
+ request.session[settings.PERMISSION_SESSION_KEY] = permissions_list
+ request.session[settings.MENU_SESSION_KEY] = menu_list
request.session['is_login'] = True
return redirect(reverse('index'))
return render(request, 'login.html')