forms.py 494 B

123456789101112131415161718
  1. from django import forms
  2. from djadhere.utils import StringWidget
  3. from .models import Adhesion, Corporation, User
  4. class UserCreationForm(forms.ModelForm):
  5. class Meta:
  6. model = User
  7. fields = ('first_name', 'last_name', 'username', 'email')
  8. def __init__(self, *args, **kwargs):
  9. super().__init__(*args, **kwargs)
  10. self.fields['first_name'].required = True
  11. self.fields['last_name'].required = True
  12. self.fields['username'].required = False