Django Library Users
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

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