123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- from django.contrib.auth.forms import AuthenticationForm
- from metaservicesynced.models import *
- from .models import SharixUser
- from django import forms
- from metaservicesynced.models import ServiceType, Service
- from .models import SharixUser
- from django import forms
- class LoginUserForm(AuthenticationForm):
- password = forms.CharField(label="Пароль",
- widget=forms.PasswordInput(attrs={'class':'form-control'}))
- username = forms.CharField(label="Номер телефона",
- widget=forms.TextInput(attrs={'class':'form-control'}))
- class Meta:
- model = SharixUser
- fields = ['username', 'password']
- class ServiceTariffUpdateForm(forms.ModelForm):
- def __init__(self, *args, **kwargs):
- super(ServiceTariffUpdateForm, self).__init__(*args, **kwargs)
- # Добавляет стиль бутстрапа form-control всем полям таблицы если у них нет своих стилей
- for field in iter(self.fields):
- if 'class' not in self.fields[field].widget.attrs:
- self.fields[field].widget.attrs.update({'class':'form-control'})
- class Meta:
- model = Service
- fields = ['status','ticket_status','servicetype_id','id_provider',
- 'resource_id','requirements','price_alg','price_km','price_min','price_amount','service_status',
- 'is_global','is_visible']
- widgets = {
- 'status': forms.TextInput(attrs={'readonly': True}, ),
- 'ticket_status': forms.TextInput(attrs={'readonly': True}),
-
- 'servicetype_id': forms.Select(attrs={'class': 'form-select'}),
- 'id_provider': forms.Select(attrs={'class': 'form-select'}),
- 'resource_id': forms.Select(attrs={'class': 'form-select'}),
- }
- class ServiceTariffCreateForm(forms.ModelForm):
- def __init__(self, *args, **kwargs):
- super(ServiceTariffCreateForm, self).__init__(*args, **kwargs)
- # Добавляет стиль бутстрапа form-control всем полям таблицы если у них нет своих стилей
- for field in iter(self.fields):
- if 'class' not in self.fields[field].widget.attrs:
- self.fields[field].widget.attrs.update({'class':'form-control'})
-
- class Meta:
- model = Service
- fields = '__all__'
- widgets = {
- 'servicetype_id': forms.Select(attrs={'class': 'form-select'}),
- 'id_provider': forms.Select(attrs={'class': 'form-select'}),
- 'resource_id': forms.Select(attrs={'class': 'form-select'}),
- 'ticket_status': forms.Select(attrs={'class': 'form-select'}),
- }
- class ServiceTypeUpdateForm(forms.ModelForm):
- def __init__(self, *args, **kwargs):
- super(ServiceTypeUpdateForm, self).__init__(*args, **kwargs)
- class Meta:
- model = ServiceType
- fields = ['status','ticket_status','id_metaservice','codename',
- 'description','requirements','price_type','link_agreement',
- 'is_global','is_visible']
- widgets = {
- 'status': forms.TextInput(attrs={'readonly': True}),
- 'ticket_status': forms.TextInput(attrs={'readonly': True}),
- }
- class ServiceTypeCreateForm(forms.ModelForm):
- def __init__(self, *args, **kwargs):
- super(ServiceTypeCreateForm, self).__init__(*args, **kwargs)
- class Meta:
- model = ServiceType
- fields = '__all__'
- widgets = {
- 'ticket_status': forms.Select(attrs={'class': 'form-select'}),
- }
- class ServiceInformationUpdateForm(forms.ModelForm):
- def __init__(self, *args, **kwargs):
- super(ServiceInformationUpdateForm, self).__init__(*args, **kwargs)
- # Добавляет стиль бутстрапа form-control всем полям таблицы если у них нет своих стилей
- for field in iter(self.fields):
- if 'class' not in self.fields[field].widget.attrs:
- self.fields[field].widget.attrs.update({'class':'form-control'})
-
-
- class Meta:
- model = Service
- fields = ['servicetype_id', 'id_provider']
- widgets = {
- # 'status': forms.TextInput(attrs={'readonly': True}),
- # 'ticket_status': forms.TextInput(attrs={'readonly': True}),
-
- 'servicetype_id': forms.Select(attrs={'class': 'form-select'}),
- #'repr_id': forms.Select(attrs={'class': 'form-select'}),
- # 'resource_id': forms.Select(attrs={'class': 'form-select'}),
- }
-
- class ServiceInformationCreateForm(forms.ModelForm):
-
- def __init__(self, *args, **kwargs):
- super(ServiceInformationCreateForm, self).__init__(*args, **kwargs)
- # Добавляет стиль бутстрапа form-control всем полям таблицы если у них нет своих стилей
- for field in iter(self.fields):
- if 'class' not in self.fields[field].widget.attrs:
- self.fields[field].widget.attrs.update({'class':'form-control'})
- class Meta:
- model = Service
- fields = ["servicetype_id", "id_provider"]
- exclude = ["resource_id"]
- widgets = {
- #'servicetype_id': forms.CharField(max_length=255)
- # 'legal_name': forms.TextInput(label = 'Название')
- # 'servicetype_id': forms.Select(attrs={'class': 'form-select'}),
- #'repr_id': forms.Select(attrs={'class': 'form-select'}),
- # 'resource_id': forms.Select(attrs={'class': 'form-select'}),
- # 'ticket_status': forms.Select(attrs={'class': 'form-select'}),
- }
- class PartnerInformationUpdateForm(forms.ModelForm):
- def __init__(self, *args, **kwargs):
- super(PartnerInformationUpdateForm, self).__init__(*args, **kwargs)
- # Добавляет стиль бутстрапа form-control всем полям таблицы если у них нет своих стилей
- for field in iter(self.fields):
- if 'class' not in self.fields[field].widget.attrs:
- self.fields[field].widget.attrs.update({'class':'form-control'})
- class Meta:
- model = Company
- fields = ['legal_name', 'address', 'repr_id' ]
- widgets = {
- 'description': forms.Select(attrs={'class': 'form-select'}),
- 'repr_id': forms.Select(attrs={'class': 'form-select'}),
- }
-
- class PartnerInformationCreateForm(forms.ModelForm):
- def __init__(self, *args, **kwargs):
- super(PartnerInformationCreateForm, self).__init__(*args, **kwargs)
- class Meta:
- model = Company
- fields = ['legal_name', 'address', 'repr_id']
-
- widgets = {
- 'description': forms.Select(attrs={'class': 'form-select'}),
- 'repr_id': forms.Select(attrs={'class': 'form-select'}),
- }
|