1234567891011121314151617181920212223242526272829303132 |
- from django import forms
- from django.contrib.auth.models import User
- from django.contrib.auth.forms import UserCreationForm, UserChangeForm
- from .models import UserProfile
-
-
- class UserRegistrationForm(UserCreationForm):
- email = forms.EmailField()
-
- class Meta:
- model = User
- fields = ['username', 'email', 'first_name', 'last_name', 'password1', 'password2']
-
-
- class UserProfileForm(forms.ModelForm):
- class Meta:
- model = UserProfile
- fields = ['timezone', 'language_code']
-
-
- class UserProfileFormLanguageOnly(forms.ModelForm):
- class Meta:
- model = UserProfile
- fields = ['language_code']
-
-
- class UserActivationForm(UserChangeForm):
- password = None
-
- class Meta:
- model = User
- fields = ['is_active', 'is_staff']
|