1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- from django import forms
- from django.contrib.auth import get_user_model
- from dbsynce.models import ServiceType, Service, Orders, Resource
- 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']
- SPECS = [
- ('0', 'Парикмахер'),
- ('1', 'Визажист'),
- ('2', 'Стилист'),
- ]
- class OrderLocalForm(forms.ModelForm):
- order_synced = forms.ModelChoiceField(queryset = Orders.objects.all(), label="Заказ")
- #resource_id = forms.ModelChoiceField(queryset = Resource.objects.all(), label="Ресурс")
- specialization = forms.ChoiceField(choices=SPECS, label="Специализация рабочего места")
- address = forms.CharField(label="Адрес коворкинга")
- daily_price = forms.CharField(label="Стоимость в день")
- date_start = forms.DateField(label="Дата начала аренды")
- date_end = forms.DateField(label="Дата завершения аренды")
- def __init__(self, *args, **kwargs):
- super(OrderLocalForm, self).__init__(*args, **kwargs)
- class Meta:
- model = OrdersLocal
- fields = [
- 'order_synced',
- #'resource_id',
- 'specialization',
- 'address',
- 'daily_price',
- 'date_start',
- 'date_end',
- ]
- def __init__(self, *args, **kwargs):
- super().__init__(*args, **kwargs)
- for field in self.fields.values():
- field.widget.attrs['class'] = 'form-control'
|