You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.4 KiB
55 lines
1.4 KiB
from django import forms
|
|
from django.forms import ModelForm
|
|
|
|
from .models import User, ContractorFinancialInfo
|
|
|
|
|
|
class UserEditForm(ModelForm):
|
|
|
|
class Meta:
|
|
model = User
|
|
fields = (
|
|
'first_name',
|
|
'last_name',
|
|
'patronym',
|
|
'location',
|
|
'date_of_birth',
|
|
'website',
|
|
'skype',
|
|
)
|
|
|
|
|
|
|
|
class ContractorFinancicalInfoForm(ModelForm):
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
super().__init__(*args, **kwargs)
|
|
self.fields['residency'].choices = self.fields['residency'].choices[1:]
|
|
self.fields['legal_status'].choices = self.fields['legal_status'].choices[1:]
|
|
|
|
# self.fields['residency'].empty_label = None
|
|
# self.fields['residency'].widget.choices = self.fields['residency'].choices
|
|
|
|
class Meta:
|
|
model = ContractorFinancialInfo
|
|
fields = (
|
|
'fio',
|
|
'date_of_birth',
|
|
'phone',
|
|
'residency',
|
|
'legal_status',
|
|
'passport_series',
|
|
'passport_number',
|
|
'subdivision_code',
|
|
'passport_issued_by',
|
|
'passport_issue_date',
|
|
'inn',
|
|
'yandex_money',
|
|
'credit_card_number',
|
|
'passport_scan',
|
|
)
|
|
|
|
widgets = {
|
|
'residency': forms.RadioSelect(),
|
|
'legal_status': forms.RadioSelect(),
|
|
}
|
|
|