You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jumpserver/apps/perms/forms.py

27 lines
1.1 KiB

8 years ago
# ~*~ coding: utf-8 ~*~
from __future__ import absolute_import, unicode_literals
from django import forms
from django.utils.translation import ugettext_lazy as _
8 years ago
from .hands import User, UserGroup, Asset, AssetGroup, SystemUser
from .models import PermUserAsset
8 years ago
8 years ago
class PermUserAssetForm(forms.ModelForm):
8 years ago
class Meta:
8 years ago
model = PermUserAsset
8 years ago
fields = [
8 years ago
'user', 'action', 'assets', 'asset_groups', 'system_users', 'date_expired', 'comment'
8 years ago
]
8 years ago
widgets = {
'user': forms.HiddenInput(attrs={'style': 'display: none'}),
'assets': forms.SelectMultiple(attrs={'class': 'select2',
'data-placeholder': _('Select assets')}),
'asset_groups': forms.SelectMultiple(attrs={'class': 'select2',
'data-placeholder': _('Select asset groups')}),
'system_users': forms.SelectMultiple(attrs={'class': 'select2',
'data-placeholder': _('Select system users')}),
}