2019-03-02 21:41:14 +00:00
|
|
|
"""passbook administrative user forms"""
|
|
|
|
|
|
|
|
from django import forms
|
|
|
|
|
2020-05-20 12:00:45 +01:00
|
|
|
from passbook.admin.fields import CodeMirrorWidget, YAMLField
|
2019-03-02 21:41:14 +00:00
|
|
|
from passbook.core.models import User
|
|
|
|
|
|
|
|
|
|
|
|
class UserForm(forms.ModelForm):
|
|
|
|
"""Update User Details"""
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
|
|
|
|
model = User
|
2019-12-31 11:51:16 +00:00
|
|
|
fields = ["username", "name", "email", "is_staff", "is_active", "attributes"]
|
2019-03-02 21:41:14 +00:00
|
|
|
widgets = {
|
2019-12-31 11:51:16 +00:00
|
|
|
"name": forms.TextInput,
|
2020-05-20 12:00:45 +01:00
|
|
|
"attributes": CodeMirrorWidget,
|
2019-10-12 13:23:03 +01:00
|
|
|
}
|
|
|
|
field_classes = {
|
2019-12-31 11:51:16 +00:00
|
|
|
"attributes": YAMLField,
|
2019-03-02 21:41:14 +00:00
|
|
|
}
|