jumpserver/apps/users/forms.py

29 lines
695 B
Python
Raw Normal View History

2016-08-14 11:18:41 +00:00
# ~*~ coding: utf-8 ~*~
from django.forms import ModelForm
2016-08-16 14:13:06 +00:00
from django import forms
2016-08-14 11:18:41 +00:00
from .models import User, UserGroup
2016-08-17 14:17:16 +00:00
class UserAddForm(ModelForm):
2016-08-14 11:18:41 +00:00
class Meta:
model = User
fields = [
2016-08-17 14:17:16 +00:00
'username', 'name', 'email', 'groups', 'wechat',
'phone', 'enable_2FA', 'role', 'date_expired', 'comment',
2016-08-14 11:18:41 +00:00
]
2016-08-16 14:13:06 +00:00
# widgets = {
# 'groups': forms.SelectMultiple(attrs={'class': 'chosen-select'})
# }
2016-08-17 14:17:16 +00:00
class UserUpdateForm(ModelForm):
class Meta:
model = User
fields = [
'name', 'email', 'groups', 'wechat', 'avatar',
'phone', 'enable_2FA', 'role', 'date_expired', 'comment',
]