company.py 615 B

1234567891011121314151617
  1. from django import forms
  2. from dbsynce.models import Company
  3. class CompanyForm(forms.ModelForm):
  4. def __init__(self, *args, **kwargs):
  5. super(CompanyForm, self).__init__(*args, **kwargs)
  6. # Добавляем класс .form-control для всех полей формы
  7. for field in iter(self.fields):
  8. if 'class' not in self.fields[field].widget.attrs:
  9. self.fields[field].widget.attrs.update({'class': 'form-control'})
  10. class Meta:
  11. model = Company
  12. fields = ['legal_name', 'inn', 'kpp', 'ogrn', 'bank_name', 'bik', 'rs', 'ks', 'address']