2019-01-20 11:57:24 +01:00
|
|
|
from django.forms import ModelForm
|
|
|
|
from django.utils.translation import gettext_lazy as _
|
|
|
|
from .models import *
|
|
|
|
|
|
|
|
|
|
|
|
class ClientForm(ModelForm):
|
2019-01-30 20:58:03 +01:00
|
|
|
|
2019-01-20 11:57:24 +01:00
|
|
|
class Meta:
|
2019-01-30 20:58:03 +01:00
|
|
|
|
2019-01-20 11:57:24 +01:00
|
|
|
model = Client
|
|
|
|
fields = '__all__'
|
2019-01-22 20:28:25 +01:00
|
|
|
labels = {
|
2019-01-22 20:26:44 +01:00
|
|
|
'id_number': _('Numer dowodu '),
|
|
|
|
'name': _('Imię '),
|
|
|
|
'surname': _('Nazwisko ')
|
2019-01-22 20:28:25 +01:00
|
|
|
}
|
2019-01-27 00:49:14 +01:00
|
|
|
|
2019-01-30 20:58:03 +01:00
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
super(ClientForm, self).__init__(*args, **kwargs)
|
|
|
|
self.fields['id_number'].error_messages = {'required': 'custom required message'}
|
|
|
|
|
|
|
|
|
2019-01-27 00:49:14 +01:00
|
|
|
|