Django Library Users
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

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']