diff --git a/apps/perms/forms.py b/apps/perms/forms.py index 989caffac..f84e56693 100644 --- a/apps/perms/forms.py +++ b/apps/perms/forms.py @@ -8,16 +8,15 @@ from .models import NodePermission class AssetPermissionForm(forms.ModelForm): - class Meta: model = NodePermission fields = [ 'node', 'user_group', 'system_user', 'is_active', - 'date_expired', 'comment' + 'date_expired', 'comment', ] widgets = { 'node': forms.Select( - attrs={'class': 'select2', 'data-placeholder': _("Node")} + attrs={'style': 'display:none'} ), 'user_group': forms.Select( attrs={'class': 'select2', 'data-placeholder': _("User group")} diff --git a/apps/perms/models.py b/apps/perms/models.py index 05cffacbc..49825e16d 100644 --- a/apps/perms/models.py +++ b/apps/perms/models.py @@ -81,7 +81,8 @@ class NodePermission(models.Model): comment = models.TextField(verbose_name=_('Comment'), blank=True) def __str__(self): - return "{}:{}:{}".format(self.node.name, self.user_group.name, self.system_user.name) + return "{}:{}:{}".format(self.node.value, self.user_group.name, self.system_user.name) class Meta: unique_together = ('node', 'user_group', 'system_user') + verbose_name = _("Asset permission") diff --git a/apps/perms/templates/perms/asset_permission_create_update.html b/apps/perms/templates/perms/asset_permission_create_update.html index efa4455cf..aafb650da 100644 --- a/apps/perms/templates/perms/asset_permission_create_update.html +++ b/apps/perms/templates/perms/asset_permission_create_update.html @@ -28,10 +28,21 @@