forms.py 1001 B

1234567891011121314151617181920212223242526272829
  1. from django import forms
  2. from SharixAdmin.models import SharixUser
  3. from webservice_running.models import Event
  4. from django.contrib.auth.forms import UserCreationForm
  5. class OrderRegForm(forms.ModelForm):
  6. class Meta:
  7. model = Event
  8. fields = '__all__'
  9. def __init__(self, *args, **kwargs):
  10. super().__init__(*args, **kwargs)
  11. for field in self.fields.values():
  12. field.widget.attrs['class'] = 'form-control'
  13. class RegisterUserForm(UserCreationForm):
  14. password1 = forms.CharField(label="Пароль",
  15. widget=forms.PasswordInput(attrs={'class':'form-control'}))
  16. password2 = forms.CharField(label="Подтверждение пароля",
  17. widget=forms.PasswordInput(attrs={'class':'form-control'}))
  18. username = forms.CharField(label="Номер телефона",
  19. widget=forms.TextInput(attrs={'class':'form-control'}))
  20. class Meta:
  21. model = SharixUser
  22. fields = ['username', 'password1', 'password2']