2020-01-26 20:47:33 +01:00
|
|
|
from django import forms
|
|
|
|
from django.contrib.auth.models import User
|
2024-10-26 20:04:32 +02:00
|
|
|
from django.contrib.auth.forms import UserCreationForm, UserChangeForm
|
2020-01-26 20:47:33 +01:00
|
|
|
from .models import UserProfile
|
|
|
|
|
|
|
|
|
|
|
|
class UserRegistrationForm(UserCreationForm):
|
|
|
|
email = forms.EmailField()
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = User
|
2024-10-26 20:04:32 +02:00
|
|
|
fields = ['username', 'email', 'first_name', 'last_name', 'password1', 'password2']
|
2020-01-26 20:47:33 +01:00
|
|
|
|
|
|
|
|
|
|
|
class UserProfileForm(forms.ModelForm):
|
|
|
|
class Meta:
|
|
|
|
model = UserProfile
|
|
|
|
fields = ['timezone', 'language_code']
|
|
|
|
|
|
|
|
|
|
|
|
class UserProfileFormLanguageOnly(forms.ModelForm):
|
|
|
|
class Meta:
|
|
|
|
model = UserProfile
|
|
|
|
fields = ['language_code']
|
2024-10-26 20:04:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
class UserActivationForm(UserChangeForm):
|
|
|
|
password = None
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = User
|
|
|
|
fields = ['is_active', 'is_staff']
|