'Clean up data and set defaults'

def clean(self):

    c = self.cleaned_data
    date_fields = (('created', 'created_date'), ('updated', 'updated_date'))
    for (field_option, field_date) in date_fields:
        if (c[field_date] != ''):
            try:
                created_timestamp = time.mktime(time.strptime(c[field_date], '%m/%d/%Y'))
                c[field_date] = int(created_timestamp)
            except (ValueError, OverflowError):
                c[field_option] = None
        else:
            c[field_option] = None
    c['num_votes'] = (c.get('num_votes') or 0)
    return c
