merge failed, update....

pull/26/head
yumaojun 9 years ago
parent 9ec2b9ff1d
commit 9379bc1f6e

@ -22,24 +22,16 @@ class SysUser(models.Model):
class PermRole(models.Model):
name = models.CharField(max_length=100)
comment = models.CharField(max_length=100)
date_added = models.DateTimeField(auto_now=True)
class UserMapping(models.Model):
role = models.ForeignKey(PermRole, related_name='user_mapping')
user = models.ForeignKey(User, related_name='user_mapping')
asset = models.ForeignKey(Asset, related_name='user_mapping')
asset_group = models.ForeignKey(AssetGroup, related_name='user_mapping', null=True, blank=True)
class GroupMapping(models.Model):
role = models.ForeignKey(PermRole, related_name='group_mapping')
usergroup = models.ForeignKey(UserGroup, related_name='group_mapping', null=True, blank=True)
asset = models.ForeignKey(Asset, related_name='group_mapping')
asset_group = models.ForeignKey(AssetGroup, related_name='group_mapping', null=True, blank=True)
class PermRule(models.Model):
date_added = models.DateTimeField(auto_now=True)
name = models.CharField(max_length=100)
comment = models.CharField(max_length=100)
asset = models.ManyToManyField(Asset)
asset_group = models.ManyToManyField(AssetGroup)
user = models.ManyToManyField(User)
user_group = models.ManyToManyField(UserGroup)
role = models.ManyToManyField(PermRole)
ssh_type = models.BooleanField()

@ -2,9 +2,9 @@ from django.conf.urls import patterns, include, url
from jperm.views import *
urlpatterns = patterns('jperm.views',
(r'^user/$', perm_user_list),
(r'^perm_user_edit/$', perm_user_edit),
(r'^perm_user_detail/$', perm_user_detail),
(r'^user/$', perm_rules),
(r'^perm_user_edit/$', perm_rule_add),
(r'^perm_user_detail/$', perm_rule_detail),
(r'^group/$', perm_group_list),
(r'^perm_group_edit/$', perm_group_edit),
(r'^log/$', log),

@ -123,3 +123,22 @@ def result2bool(result=''):
return '<b style="color: red">失败</b>'
else:
return '<b style="color: green">成功</b>'
@register.filter(name='rule_member_count')
def rule_member_count(instance, member):
member = getattr(instance, member)
counts = member.all().count()
return str(counts)
@register.filter(name='rule_member_name')
def rule_member_name(instance, member):
member = getattr(instance, member)
names = member.all()
return names

@ -9,8 +9,6 @@ class UserGroup(models.Model):
# assets = models.TextField(max_length=1000, verbose_name="Assets", default='')
# asset_groups = models.CharField(max_length=1000, verbose_name="Asset Groups", default='')
comment = models.CharField(max_length=160, blank=True, null=True)
#asset = models.ManyToManyField(Asset)
#asset_group = models.ManyToManyField(AssetGroup)
def __unicode__(self):
return self.name

@ -58,7 +58,7 @@
<a href="/jasset/asset_list/?gid={{ user.id }}">{{ rule | rule_member_count:"user" }} </a>
</td>
<td class="text-center">
<a href="/jasset/group_list/?gid={{ user.id }}">{{ rule | rule_member_count:"usergroup" }}</a>
<a href="/jasset/group_list/?gid={{ user.id }}">{{ rule | rule_member_count:"user_group" }}</a>
</td>
<td class="text-center">
<a href="/jasset/group_list/?gid={{ user.id }}">{{ rule | rule_member_count:"asset" }}</a>

Loading…
Cancel
Save