class AddForm(forms.BPMTaskForm): a = forms.IntegerField(label="First number", initial=2, help_text="Must be a integer number", max_value=999, min_value=0) b = forms.IntegerField(label="Second number", initial=2, help_text="Must be a integer number", max_value=999, min_value=0)
def testIntegerField(self): testfield = forms.IntegerField( max_value=999, min_value=0) ext_dict = testfield.to_ext_dict('testfield') self.assertIn('max_value', ext_dict) self.assertIn('min_value', ext_dict) self.assertEqual(ext_dict['max_value'], 999) self.assertEqual(ext_dict['min_value'], 0)
def testForm(self): class TestForm(forms.BPMTaskForm): one = forms.IntegerField() two = forms.CharField() field = forms.IntegerField() testform = TestForm() fields = testform.get_fields() self.assertEqual(len(fields), 2) self.assertEqual(field.to_ext_dict('one'), fields[0])
class SubprocessForm(forms.BPMTaskForm): class Meta: title = _('start a subprocess') description = '' workflow = forms.ModelChoiceField(queryset=Workflow.objects.all(), label="Workflow", empty_label=None) name = forms.CharField(max_length=100, label="Name") priority = forms.IntegerField(min_value=0, max_value=9, initial=9, label="Priority")
class TestForm(forms.BPMTaskForm): one = forms.IntegerField() two = forms.CharField()
class WaitForm(forms.BPMTaskForm): secs = forms.IntegerField(label="How many seconds to wait", initial=2, help_text="Must be a integer number", max_value=999, min_value=0)