示例#1
0
 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}
示例#2
0
 def __init__(self, *args, **kwargs):
     super(AccessIdentityDataForm, self).__init__(*args, **kwargs)
     self.nationality.choices = [('', '')] + sorted(
         get_countries().iteritems(), key=itemgetter(1))
示例#3
0
 def wtf_field_kwargs(self):
     return {'choices': sorted(get_countries().iteritems(), key=itemgetter(1))}
示例#4
0
 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}
示例#5
0
 def wtf_field_kwargs(self):
     return {'choices': sorted(get_countries().iteritems(), key=itemgetter(1))}
示例#6
0
def test_get_countries(mocker, country):
    mocker.patch('indico.util.countries.config', MockConfig())
    countries = get_countries()
    assert countries[country] == MockConfig.CUSTOM_COUNTRIES[country]