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',
|
2016-08-15 13:10:30 +00:00
|
|
|
'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',
|
|
|
|
]
|
|
|
|
|