Exemplo n.º 1
0
class AgendarForm(forms.Form):
    CHOICES=(('1','Básico'),('2','Intermedio'),('3','Avanzado'))
    #hora_inicio= forms.DateTimeField(widget=widgets.AdminDateWidget())
    #hora_inicio= forms.DateTimeField(widget=)
    num_paquete= forms.ChoiceField(choices=CHOICES)
    #fecha = forms.DateField(widget=SelectDateWidget(empty_label="Nothing"),label="Fecha")
    hora= forms.DateField(widget=SuitTimeWidget(attrs={'placeholder':'Time'}))
    fecha2= forms.DateField(widget=SuitDateWidget)
Exemplo n.º 2
0
 def __init__(self,
              attrs=None,
              date_attrs=None,
              date_format=None,
              time_attrs=None,
              time_format=None):
     widgets = [
         SuitDateWidget(attrs=date_attrs, format=date_format),
         SuitTimeWidget(attrs=time_attrs, format=time_format)
     ]
     forms.MultiWidget.__init__(self, widgets, attrs)
Exemplo n.º 3
0
class WorkingHoursInline(StackedInline):
    model = WorkingHours
    verbose_name = 'Weekday'
    verbose_name_plural = 'Comfortable hours'
    formfield_overrides = {
        models.TimeField: {
            'widget':
            SuitTimeWidget(attrs={
                'placeholder': '16:45',
                'maxlength': '5',
                'class': 'numonly'
            })
        }
    }
Exemplo n.º 4
0
 def test_SuitTimeWidget_output(self):
     sdw = SuitTimeWidget(attrs={'placeholder': 'Time'})
     output = sdw.render('sdw', '')
     self.assertHTMLEqual(
         self.get_SuitTimeWidget_output(),
         output)
Exemplo n.º 5
0
 def test_SuitTimeWidget_with_existing_placeholder_attr(self):
     sdw = SuitTimeWidget(attrs={'class': 'custom-cls', 'placeholder': 'p'})
     self.assertTrue('vTimeField ' in sdw.attrs['class'])
     self.assertTrue(' custom-cls' in sdw.attrs['class'])
     self.assertEqual('p', sdw.attrs['placeholder'])
Exemplo n.º 6
0
 def test_SuitTimeWidget_with_existing_class_attr(self):
     sdw = SuitTimeWidget(attrs={'class': 'custom-class'})
     self.assertTrue('vTimeField ' in sdw.attrs['class'])
     self.assertTrue(' custom-class' in sdw.attrs['class'])
     self.assertEqual(_('Time:')[:-1], sdw.attrs['placeholder'])
Exemplo n.º 7
0
 def test_SuitTimeWidget(self):
     sdw = SuitTimeWidget()
     self.assertTrue('vTimeField' in sdw.attrs['class'])
Exemplo n.º 8
0
 def test_SuitTimeWidget_output(self):
     sdw = SuitTimeWidget(attrs={'placeholder': 'Time'})
     output = sdw.render('sdw', '')
     self.assertHTMLEqual(self.get_SuitTimeWidget_output(), output)