Django Library Users
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

forms.py 604B

123456789101112131415161718192021222324
  1. from django import forms
  2. from django.contrib.auth.models import User
  3. from django.contrib.auth.forms import UserCreationForm
  4. from .models import UserProfile
  5. class UserRegistrationForm(UserCreationForm):
  6. email = forms.EmailField()
  7. class Meta:
  8. model = User
  9. fields = ['username', 'email', 'password1', 'password2']
  10. class UserProfileForm(forms.ModelForm):
  11. class Meta:
  12. model = UserProfile
  13. fields = ['timezone', 'language_code']
  14. class UserProfileFormLanguageOnly(forms.ModelForm):
  15. class Meta:
  16. model = UserProfile
  17. fields = ['language_code']