Browse Source

ÐÞ¸Äperm

pull/6/head
guanghongwei 10 years ago
parent
commit
ecbba5ea61
  1. 2
      jperm/models.py
  2. 8
      jperm/views.py

2
jperm/models.py

@ -3,7 +3,7 @@ from juser.models import User
from jasset.models import Asset
class Permission(models.Model):
class Perm(models.Model):
USER_ROLE_CHOICES = (
('SU', 'SuperUser'),
('CU', 'CommonUser'),

8
jperm/views.py

@ -4,7 +4,7 @@ from django.shortcuts import render_to_response
from django.http import HttpResponseRedirect
from juser.models import User
from jasset.models import Asset
from jperm.models import Permission
from jperm.models import Perm
from django.core.paginator import Paginator, EmptyPage, InvalidPage
@ -33,7 +33,7 @@ def perm_add(request):
user = User.objects.get(username=username)
permed_hosts = []
for perm in user.permission_set.all():
for perm in user.perm_set.all():
permed_hosts.append(perm.asset)
hosts_all = Asset.objects.all()
@ -46,7 +46,7 @@ def perm_add(request):
user = User.objects.get(username=username)
for id in host_ids:
asset = Asset.objects.get(id=id)
perm = Permission(user=user, asset=asset)
perm = Perm(user=user, asset=asset)
perm.save()
msg = u'添加æˆåŠŸ'
@ -67,7 +67,7 @@ def perm_list(request):
user = User.objects.get(username=username)
hosts = []
for perm in user.permission_set.all():
for perm in user.perm_set.all():
hosts.append(perm.asset)
return render_to_response('jperm/perm_list.html', locals())

Loading…
Cancel
Save