def unprocess_field_data(cls, versioned_data, unversioned_data): choices = sorted(({ 'caption': v, 'countryKey': k } for k, v in get_countries().iteritems()), key=itemgetter('caption')) return {'choices': choices}
def __init__(self, *args, **kwargs): super(AccessIdentityDataForm, self).__init__(*args, **kwargs) self.nationality.choices = [('', '')] + sorted( get_countries().iteritems(), key=itemgetter(1))
def wtf_field_kwargs(self): return {'choices': sorted(get_countries().iteritems(), key=itemgetter(1))}
def unprocess_field_data(cls, versioned_data, unversioned_data): choices = sorted(({'caption': v, 'countryKey': k} for k, v in get_countries().iteritems()), key=itemgetter('caption')) return {'choices': choices}
def wtf_field_kwargs(self): return {'choices': sorted(get_countries().iteritems(), key=itemgetter(1))}
def test_get_countries(mocker, country): mocker.patch('indico.util.countries.config', MockConfig()) countries = get_countries() assert countries[country] == MockConfig.CUSTOM_COUNTRIES[country]