def __init__(self, *args, **kwargs): calendar = kwargs.pop('calendar', None) super(EventsModelForm, self).__init__(*args, **kwargs) _instance = kwargs.pop('instance', None) add_class_time_picker(self, ['event_start', 'event_end']) # if _instance and _instance.calendar.type == Calendar.CAPACITATION: # self.fields['type_capacitations'] = forms.ChoiceField(choices=Events.type_capacitation) if calendar and (calendar.type == CAPACITATION or calendar.type == CHARLAS): self.fields['hours_worked'] = forms.FloatField( label='Horas Trabajadas', required=False) self.fields['number_workers'] = forms.IntegerField( label='Numero de Trabajadores', required=False) if calendar and calendar.type == CAPACITATION: self.fields['type_capacitations'] = forms.ChoiceField( choices=type_capacitation, label='Tipo de Capacitacion', required=True, initial=-1, widget=forms.Select()) if calendar and calendar.type == INSPECTION: self.fields['type_inspeccions'] = forms.ChoiceField( choices=type_inspeccion, label='Tipo de Inspeccion', required=True, initial=-1, widget=forms.Select()) add_form_control_class(self.fields)
def __init__(self, *args, **kwargs): super(AgreementDetailForm, self).__init__(*args, **kwargs) # _instance = kwargs.pop('instance', None) # self.fields['description'].widget.attrs['class'] = 'form-control' # self.fields['date_until'].widget.attrs['class'] = 'form-control input-datepicker' # self.fields['date_start'].widget.attrs['class'] = 'form-control input-datepicker' # self.fields['state'].widget.attrs['class'] = 'form-control' # self.fields['evidence'].widget.attrs['class'] = 'form-control' add_form_control_class(self.fields)
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) add_form_control_class(self.fields) labels = { 'code': 'Numero de guia *', 'transport_name': 'Empresa de Transporte *', 'note': 'Nota *', } update_form_labels(self, labels) add_form_required(self.fields) self.fields['note'].widget.attrs.update( {'placeholder': 'ejm. descripcion del empaquetamiento'})
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) add_form_control_class(self.fields) labels = { 'name': 'Nombre *', 'size': 'Talla *', 'image': 'Imagen', 'price': 'Precio *', 'available': 'Habilitado' } update_form_labels(self, labels) self.fields["colors"].widget = CheckboxSelectMultiple() self.fields["colors"].queryset = Color.objects.all()
def __init__(self, *args, **kwargs): user = kwargs.pop('user', None) super(CalendarModelForm, self).__init__(*args, **kwargs) _instance = kwargs.pop('instance', None) if user: group = Group.objects.get(name="Doctor") if group in user.groups.all(): self.fields['type'] = forms.IntegerField( label="Tipo", required=False, widget=forms.TextInput(attrs={ 'placeholder': 'Doctor', 'readonly': True })) add_form_control_class(self.fields)
def __init__(self, *args, **kwargs): super(AuthenticationFormEdited, self).__init__(*args, **kwargs) self.fields['username'].label = _('email') add_form_control_class(self.fields)
def __init__(self, *args, **kwargs): super(WorkerForm, self).__init__(*args, **kwargs) _instance = kwargs.pop('instance', None) add_form_control_class(self.fields) self.fields['date_out'].required = False
def __init__(self, *args, **kwargs): super(AgreementForm, self).__init__(*args, **kwargs) _instance = kwargs.pop('instance', None) add_form_control_class(self.fields)