Ticket #15667: test.py

File test.py, 1.2 KB (added by Anssi Kääriäinen, 14 years ago)

Performance test

Line 
1from django import forms
2
3class TestForm(forms.Form):
4 f1 = forms.IntegerField()
5 f2 = forms.IntegerField()
6 f3 = forms.IntegerField()
7 f4 = forms.IntegerField()
8 f5 = forms.IntegerField()
9 f6 = forms.IntegerField()
10 f7 = forms.IntegerField()
11 f8 = forms.IntegerField()
12 f9 = forms.IntegerField()
13 f10 = forms.IntegerField()
14 f11 = forms.IntegerField()
15
16CHOICES = [(i, unicode(i)) for i in range(1, 100)]
17class TestForm2(forms.Form):
18 f1 = forms.MultipleChoiceField(choices=CHOICES)
19 """
20 f2 = forms.MultipleChoiceField(choices=CHOICES)
21 f3 = forms.MultipleChoiceField(choices=CHOICES)
22 f4 = forms.MultipleChoiceField(choices=CHOICES)
23 f5 = forms.MultipleChoiceField(choices=CHOICES)
24 f6 = forms.MultipleChoiceField(choices=CHOICES)
25 f7 = forms.MultipleChoiceField(choices=CHOICES)
26 f8 = forms.MultipleChoiceField(choices=CHOICES)
27 f9 = forms.MultipleChoiceField(choices=CHOICES)
28 f10 = forms.MultipleChoiceField(choices=CHOICES)
29 f11 = forms.MultipleChoiceField(choices=CHOICES)
30 """
31
32data = dict([('f%d' % i, (i,)) for i in range(1, 12)])
33
34def render_it():
35 f = TestForm(data)
36 return f.as_table()
37
38def render_it2():
39 f2 = TestForm2(data)
40 return f2.as_table()
Back to Top