fields.py
Nathan Osman — 3¬†years, 10¬†months ago


from django import forms
from widgets import TestWidget
class TestField(forms.MultiValueField):
widget = TestWidget
def __init__(self, *args, **kwargs):
fields = (
forms.IntegerField(min_value=0, max_value=15),
forms.IntegerField(min_value=0, max_value=15),
)
super(TestField, self).__init__(*args, **kwargs)
def compress(self, data_list):
if data_list:
return '%02d:%02d' % tuple(data_list)
return None