|
@@ -1,7 +1,6 @@
|
|
|
from django.forms import ModelForm
|
|
|
from django.contrib.auth.models import User
|
|
|
|
|
|
-from djadhere.forms import ReadOnlyModelForm
|
|
|
from .models import Profile
|
|
|
|
|
|
|
|
@@ -11,16 +10,11 @@ class UserCreateForm(ModelForm):
|
|
|
fields = ('username', 'first_name', 'last_name', 'email',)
|
|
|
|
|
|
|
|
|
-class UserChangeForm(ReadOnlyModelForm):
|
|
|
- #def __init__(self, *args, **kwargs):
|
|
|
- # super().__init__(*args, **kwargs)
|
|
|
- # for key in self.Meta.readonly_fields:
|
|
|
- # self.fields[key].disabled = True
|
|
|
-
|
|
|
+class UserChangeForm(ModelForm):
|
|
|
class Meta:
|
|
|
model = User
|
|
|
fields = ('username', 'first_name', 'last_name', 'email',)
|
|
|
- readonly_fields = ('username', 'first_name', 'last_name',)
|
|
|
+ admin_only_fields = ('username', 'first_name', 'last_name',)
|
|
|
|
|
|
|
|
|
class ProfileForm(ModelForm):
|