1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- from django.contrib.auth.forms import AuthenticationForm
- from metaservicesynced.models import *
- 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 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 = {
- # '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 PartnerInformationCreateForm(forms.ModelForm):
- def __init__(self, *args, **kwargs):
- super(PartnerInformationCreateForm, 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'})
-
- # legal_name = forms.CharField(label = "Название",
- # widget=forms.TextInput(attrs={'class':'form-control'}))
- class Meta:
- model = Company
- fields = ['legal_name', 'address', 'repr_id']
-
- widgets = {
- # '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'}),
- }
|