Skip to content

Instantly share code, notes, and snippets.

@jeanphix
Created November 3, 2011 13:03
Show Gist options
  • Save jeanphix/1336422 to your computer and use it in GitHub Desktop.
Save jeanphix/1336422 to your computer and use it in GitHub Desktop.
WTForms CountrySelectField
import pycountry
class CountrySelectField(SelectField):
def __init__(self, *args, **kwargs):
super(CountrySelectField, self).__init__(*args, **kwargs)
self.choices = [(c.alpha3, c.name) for c in pycountry.countries]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment