修改组添加

pull/6/head
guanghongwei 2015-01-10 13:50:59 +08:00
parent c6e0429584
commit 65b29cb68d
1 changed files with 5 additions and 5 deletions

View File

@ -2,7 +2,7 @@
from django.shortcuts import render_to_response
from juser.models import Group, User
from juser.models import UserGroup, User
class AddError(Exception):
@ -21,12 +21,12 @@ def group_add(request):
error = u'缁勫悕涓嶈兘涓虹┖'
raise AddError
group = Group.objects.filter(name=group_name)
group = UserGroup.objects.filter(name=group_name)
if group:
error = u'%s 宸插瓨鍦' % group_name
raise AddError
group = Group(name=group_name, comment=comment)
group = UserGroup(name=group_name, comment=comment)
group.save()
except AddError:
pass
@ -44,7 +44,7 @@ def group_add(request):
def group_list(request):
groups = Group.objects.all()
groups = UserGroup.objects.all()
return render_to_response('juser/group_list.html',
{'header_title': u'鏌ョ湅灞炵粍 | Add Group',
'path1': 'juser', 'path2': 'group_add',
@ -60,7 +60,7 @@ def user_add(request):
msg = ''
user_role = {'SU': 'SuperUser', 'GA': 'GroupAdmin', 'CU': 'CommonUser'}
groups = Group.objects.all()
groups = UserGroup.objects.all()
if request.method == 'POST':
username = request.POST.get('j_username', None)
password = request.POST.get('j_password', None)