Files
consumocuidado-server/core/forms.py
2021-04-05 11:55:09 +01:00

26 lines
898 B
Python

from django import forms
from django.contrib.auth.forms import UserChangeForm, UserCreationForm, AdminPasswordChangeForm
from django.forms import ModelForm
from django.contrib.auth import get_user_model
User = get_user_model()
class CustomUserCreationForm(UserCreationForm):
class Meta(UserCreationForm.Meta):
model = User
UserCreationForm.Meta.fields = ('email',)
fields = UserCreationForm.Meta.fields + ('full_name','role', 'notify', 'provider', 'email_verified', 'company', 'is_active', 'is_staff')
UserCreationForm.Meta.fields = ('password1','password2',)
class CustomUserChangeForm(UserChangeForm):
class Meta(UserChangeForm.Meta):
model = User
UserChangeForm.Meta.fields = ('email',)
fields = UserChangeForm.Meta.fields + ('full_name','role', 'notify', 'provider', 'email_verified', 'company', 'is_active', 'is_staff')