from django import forms from django.contrib.auth import get_user_model from webservice_running.models import OrdersLocal from django.contrib.auth.forms import UserCreationForm class OrderRegForm(forms.ModelForm): class Meta: model = OrdersLocal fields = '__all__' def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) for field in self.fields.values(): field.widget.attrs['class'] = 'form-control' class RegisterUserForm(UserCreationForm): password1 = forms.CharField(label="Пароль", widget=forms.PasswordInput(attrs={'class':'form-control'})) password2 = forms.CharField(label="Подтверждение пароля", widget=forms.PasswordInput(attrs={'class':'form-control'})) username = forms.CharField(label="Номер телефона", widget=forms.TextInput(attrs={'class':'form-control'})) class Meta: model = get_user_model() fields = ['username', 'password1', 'password2']