diff --git a/.idea/workspace.xml b/.idea/workspace.xml index e812634..21a465e 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -15,8 +15,8 @@ >>>>>>> 1-rbac - +<<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD @@ -26,6 +26,8 @@ >>>>>>> a328e88122d80e72999261759f2594796f8da35b ======= +>>>>>>> 1-rbac +======= >>>>>>> 1-rbac @@ -44,6 +46,7 @@ <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD @@ -58,6 +61,10 @@ ======= +>>>>>>> 1-rbac +======= + + >>>>>>> 1-rbac @@ -70,6 +77,7 @@ <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD @@ -86,6 +94,10 @@ ======= +======= + + +>>>>>>> 1-rbac @@ -94,10 +106,11 @@ - - + + <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD @@ -105,27 +118,34 @@ ======= +======= + + +>>>>>>> 1-rbac - + >>>>>>> 1-rbac - - + + - - - + + + + + - - + + +<<<<<<< HEAD <<<<<<< HEAD @@ -148,6 +168,11 @@ +>>>>>>> 1-rbac +======= + + + >>>>>>> 1-rbac @@ -158,8 +183,8 @@ - + @@ -194,11 +219,15 @@ - - - + + + + + + + @@ -208,10 +237,14 @@ true DEFINITION_ORDER +<<<<<<< HEAD <<<<<<< HEAD ======= +======= + +>>>>>>> 1-rbac >>>>>>> 1-rbac @@ -250,7 +283,7 @@ - + @@ -266,32 +299,20 @@ - - - - - - + - - - - - - - - + - + @@ -303,15 +324,16 @@ - - - + - + + + + @@ -377,18 +399,22 @@ +<<<<<<< HEAD <<<<<<< HEAD ======= +>>>>>>> 1-rbac +======= + >>>>>>> 1-rbac - + @@ -396,8 +422,8 @@ - + @@ -421,83 +447,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -555,13 +504,6 @@ - - - - - - - @@ -590,13 +532,6 @@ - - - - - - - @@ -668,13 +603,6 @@ - - - - - - - <<<<<<< HEAD @@ -706,6 +634,7 @@ +<<<<<<< HEAD @@ -716,6 +645,8 @@ +======= +>>>>>>> 1-rbac @@ -747,13 +678,6 @@ - - - - - - - @@ -818,48 +742,189 @@ - + - - + + - - - - - - - - - - - - - - - - - - - - - + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD @@ -876,6 +941,10 @@ ======= +>>>>>>> 1-rbac +======= + + >>>>>>> 1-rbac diff --git a/apps/__pycache__/custom.cpython-36.pyc b/apps/__pycache__/custom.cpython-36.pyc new file mode 100644 index 0000000..4c1262f Binary files /dev/null and b/apps/__pycache__/custom.cpython-36.pyc differ diff --git a/apps/custom.py b/apps/custom.py new file mode 100644 index 0000000..67e2975 --- /dev/null +++ b/apps/custom.py @@ -0,0 +1,21 @@ +# @Time : 2018/11/9 22:06 +# @Author : RobbieHan +# @File : custom.py + +import json + +from django.views.generic import CreateView +from django.shortcuts import HttpResponse + +from system.mixin import LoginRequiredMixin + + +class SimpleInfoCreateView(LoginRequiredMixin, CreateView): + + def post(self, request, *args, **kwargs): + res = dict(result=False) + form = self.get_form() + if form.is_valid(): + form.save() + res['result'] = True + return HttpResponse(json.dumps(res), content_type='application/json') diff --git a/apps/system/__pycache__/forms.cpython-36.pyc b/apps/system/__pycache__/forms.cpython-36.pyc index a4f30b7..56b28e7 100644 Binary files a/apps/system/__pycache__/forms.cpython-36.pyc and b/apps/system/__pycache__/forms.cpython-36.pyc differ diff --git a/apps/system/__pycache__/models.cpython-36.pyc b/apps/system/__pycache__/models.cpython-36.pyc index e2c321e..5f4dd80 100644 Binary files a/apps/system/__pycache__/models.cpython-36.pyc and b/apps/system/__pycache__/models.cpython-36.pyc differ diff --git a/apps/system/__pycache__/urls.cpython-36.pyc b/apps/system/__pycache__/urls.cpython-36.pyc index c7b32f5..6bf5a5c 100644 Binary files a/apps/system/__pycache__/urls.cpython-36.pyc and b/apps/system/__pycache__/urls.cpython-36.pyc differ diff --git a/apps/system/__pycache__/views_menu.cpython-36.pyc b/apps/system/__pycache__/views_menu.cpython-36.pyc new file mode 100644 index 0000000..11b3e31 Binary files /dev/null and b/apps/system/__pycache__/views_menu.cpython-36.pyc differ diff --git a/apps/system/__pycache__/views_structure.cpython-36.pyc b/apps/system/__pycache__/views_structure.cpython-36.pyc index a931d6a..2b4d80b 100644 Binary files a/apps/system/__pycache__/views_structure.cpython-36.pyc and b/apps/system/__pycache__/views_structure.cpython-36.pyc differ diff --git a/apps/system/__pycache__/views_user.cpython-36.pyc b/apps/system/__pycache__/views_user.cpython-36.pyc index 9009685..4f7f5e7 100644 Binary files a/apps/system/__pycache__/views_user.cpython-36.pyc and b/apps/system/__pycache__/views_user.cpython-36.pyc differ diff --git a/apps/system/forms.py b/apps/system/forms.py index 58cb4c0..4f9761f 100644 --- a/apps/system/forms.py +++ b/apps/system/forms.py @@ -6,7 +6,7 @@ import re from django import forms from django.contrib.auth import get_user_model -from .models import Structure +from .models import Structure, Menu User = get_user_model() @@ -118,4 +118,10 @@ class PasswordChangeForm(forms.Form): password = cleaned_data.get("password") confirm_password = cleaned_data.get("confirm_password") if password != confirm_password: - raise forms.ValidationError("两次密码输入不一致") \ No newline at end of file + raise forms.ValidationError("两次密码输入不一致") + + +class MenuForm(forms.ModelForm): + class Meta: + model = Menu + fields = '__all__' diff --git a/apps/system/urls.py b/apps/system/urls.py index 7f45c89..47bfdb2 100644 --- a/apps/system/urls.py +++ b/apps/system/urls.py @@ -1,7 +1,7 @@ from django.urls import path, re_path from .views import SystemView -from . import views_structure, views_user +from . import views_structure, views_user, views_menu app_name = 'system' @@ -22,4 +22,6 @@ urlpatterns = [ path('basic/user/delete/', views_user.UserDeleteView.as_view(), name='basic-user-delete'), path('basic/user/enable/', views_user.UserEnableView.as_view(), name='basic-user-enable'), path('basic/user/disable/', views_user.UserDisableView.as_view(), name='basic-user-disable'), + + path('rbac/menu/create/', views_menu.MenuCreateView.as_view(), name='rbac-menu-create'), ] diff --git a/apps/system/views_menu.py b/apps/system/views_menu.py new file mode 100644 index 0000000..f522b10 --- /dev/null +++ b/apps/system/views_menu.py @@ -0,0 +1,17 @@ +# @Time : 2018/11/9 12:24 +# @Author : RobbieHan +# @File : views.menu.py + +from apps.custom import SimpleInfoCreateView +from .models import Menu + + +class MenuCreateView(SimpleInfoCreateView): + model = Menu + fields = '__all__' + extra_context = dict(menu_all=Menu.objects.all()) + + + + + diff --git a/db.sqlite3 b/db.sqlite3 index 1977f0d..4153a6b 100644 Binary files a/db.sqlite3 and b/db.sqlite3 differ diff --git a/sandboxMP/__pycache__/urls.cpython-36.pyc b/sandboxMP/__pycache__/urls.cpython-36.pyc index 4b44540..fb9f7a1 100644 Binary files a/sandboxMP/__pycache__/urls.cpython-36.pyc and b/sandboxMP/__pycache__/urls.cpython-36.pyc differ diff --git a/templates/system/menu_form.html b/templates/system/menu_form.html new file mode 100644 index 0000000..d681c13 --- /dev/null +++ b/templates/system/menu_form.html @@ -0,0 +1,101 @@ +{% extends 'base-layer.html' %} +{% load staticfiles %} +{% block css %} + + +{% endblock %} +{% block main %} + + + {% csrf_token %} + + + + 添加菜单 + + + 名称 + + + + 代码 + + + + + + 图标 + + + + 父菜单 + + + {{ menu.parent.name }} + {% for parent_menu in menu_all %} + {{ parent_menu.name }} + {% endfor %} + + + + + URL + + + + + + + + + + + + +{% endblock %} + +{% block javascripts %} + + + +{% endblock %}