Japan (jp)


JP-specific Form helpers.

class localflavor.jp.forms.JPPostalCodeField(max_length=None, min_length=None, *args, **kwargs)[source]

A form field that validates its input is a Japanese postcode.

Accepts 7 digits, with or without a hyphen.


Validates the input and returns a string that contains only numbers.

Returns an empty string for empty values.

class localflavor.jp.forms.JPPrefectureCodeSelect(attrs=None)[source]

A Select widget for Japanese prefecture codes.

It uses a list of Japanese prefectures as its choices and the prefectures code as the post value.

class localflavor.jp.forms.JPPrefectureSelect(attrs=None)[source]

A Select widget that uses a list of Japanese prefectures as its choices.


localflavor.jp.jp_prefectures.JP_PREFECTURES = (('hokkaido', 'Hokkaido'), ('aomori', 'Aomori'), ('iwate', 'Iwate'), ('miyagi', 'Miyagi'), ('akita', 'Akita'), ('yamagata', 'Yamagata'), ('fukushima', 'Fukushima'), ('ibaraki', 'Ibaraki'), ('tochigi', 'Tochigi'), ('gunma', 'Gunma'), ('saitama', 'Saitama'), ('chiba', 'Chiba'), ('tokyo', 'Tokyo'), ('kanagawa', 'Kanagawa'), ('niigata', 'Niigata'), ('toyama', 'Toyama'), ('ishikawa', 'Ishikawa'), ('fukui', 'Fukui'), ('yamanashi', 'Yamanashi'), ('nagano', 'Nagano'), ('gifu', 'Gifu'), ('shizuoka', 'Shizuoka'), ('aichi', 'Aichi'), ('mie', 'Mie'), ('shiga', 'Shiga'), ('kyoto', 'Kyoto'), ('osaka', 'Osaka'), ('hyogo', 'Hyogo'), ('nara', 'Nara'), ('wakayama', 'Wakayama'), ('tottori', 'Tottori'), ('shimane', 'Shimane'), ('okayama', 'Okayama'), ('hiroshima', 'Hiroshima'), ('yamaguchi', 'Yamaguchi'), ('tokushima', 'Tokushima'), ('kagawa', 'Kagawa'), ('ehime', 'Ehime'), ('kochi', 'Kochi'), ('fukuoka', 'Fukuoka'), ('saga', 'Saga'), ('nagasaki', 'Nagasaki'), ('kumamoto', 'Kumamoto'), ('oita', 'Oita'), ('miyazaki', 'Miyazaki'), ('kagoshima', 'Kagoshima'), ('okinawa', 'Okinawa'))

A list of prefectures