2007-04-01 04:40:36 +00:00
# -*- coding: utf-8 -*-
# Tests for the different contrib/localflavor/ form fields.
localflavor_tests = r """
# USZipCodeField ##############################################################
USZipCodeField validates that the data is either a five - digit U . S . zip code or
a zip + 4.
2007-04-08 11:21:00 +00:00
>> > from django . contrib . localflavor . us . forms import USZipCodeField
2007-04-01 04:40:36 +00:00
>> > f = USZipCodeField ( )
>> > f . clean ( ' 60606 ' )
u ' 60606 '
>> > f . clean ( 60606 )
u ' 60606 '
>> > f . clean ( ' 04000 ' )
u ' 04000 '
>> > f . clean ( ' 4000 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a zip code in the format XXXXX or XXXXX-XXXX. ' ]
>> > f . clean ( ' 60606-1234 ' )
u ' 60606-1234 '
>> > f . clean ( ' 6060-1234 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a zip code in the format XXXXX or XXXXX-XXXX. ' ]
>> > f . clean ( ' 60606- ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a zip code in the format XXXXX or XXXXX-XXXX. ' ]
>> > f . clean ( None )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field is required. ' ]
>> > f . clean ( ' ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field is required. ' ]
>> > f = USZipCodeField ( required = False )
>> > f . clean ( ' 60606 ' )
u ' 60606 '
>> > f . clean ( 60606 )
u ' 60606 '
>> > f . clean ( ' 04000 ' )
u ' 04000 '
>> > f . clean ( ' 4000 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a zip code in the format XXXXX or XXXXX-XXXX. ' ]
>> > f . clean ( ' 60606-1234 ' )
u ' 60606-1234 '
>> > f . clean ( ' 6060-1234 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a zip code in the format XXXXX or XXXXX-XXXX. ' ]
>> > f . clean ( ' 60606- ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a zip code in the format XXXXX or XXXXX-XXXX. ' ]
>> > f . clean ( None )
u ' '
>> > f . clean ( ' ' )
u ' '
# USPhoneNumberField ##########################################################
USPhoneNumberField validates that the data is a valid U . S . phone number ,
including the area code . It ' s normalized to XXX-XXX-XXXX format.
2007-04-08 11:21:00 +00:00
>> > from django . contrib . localflavor . us . forms import USPhoneNumberField
2007-04-01 04:40:36 +00:00
>> > f = USPhoneNumberField ( )
>> > f . clean ( ' 312-555-1212 ' )
u ' 312-555-1212 '
>> > f . clean ( ' 3125551212 ' )
u ' 312-555-1212 '
>> > f . clean ( ' 312 555-1212 ' )
u ' 312-555-1212 '
>> > f . clean ( ' (312) 555-1212 ' )
u ' 312-555-1212 '
>> > f . clean ( ' 312 555 1212 ' )
u ' 312-555-1212 '
>> > f . clean ( ' 312.555.1212 ' )
u ' 312-555-1212 '
>> > f . clean ( ' 312.555-1212 ' )
u ' 312-555-1212 '
>> > f . clean ( ' (312) 555.1212 ' )
u ' 312-555-1212 '
>> > f . clean ( ' 555-1212 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Phone numbers must be in XXX-XXX-XXXX format. ' ]
>> > f . clean ( ' 312-55-1212 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Phone numbers must be in XXX-XXX-XXXX format. ' ]
>> > f . clean ( None )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field is required. ' ]
>> > f . clean ( ' ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field is required. ' ]
>> > f = USPhoneNumberField ( required = False )
>> > f . clean ( ' 312-555-1212 ' )
u ' 312-555-1212 '
>> > f . clean ( ' 3125551212 ' )
u ' 312-555-1212 '
>> > f . clean ( ' 312 555-1212 ' )
u ' 312-555-1212 '
>> > f . clean ( ' (312) 555-1212 ' )
u ' 312-555-1212 '
>> > f . clean ( ' 312 555 1212 ' )
u ' 312-555-1212 '
>> > f . clean ( ' 312.555.1212 ' )
u ' 312-555-1212 '
>> > f . clean ( ' 312.555-1212 ' )
u ' 312-555-1212 '
>> > f . clean ( ' (312) 555.1212 ' )
u ' 312-555-1212 '
>> > f . clean ( ' 555-1212 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Phone numbers must be in XXX-XXX-XXXX format. ' ]
>> > f . clean ( ' 312-55-1212 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Phone numbers must be in XXX-XXX-XXXX format. ' ]
>> > f . clean ( None )
u ' '
>> > f . clean ( ' ' )
u ' '
# USStateField ################################################################
USStateField validates that the data is either an abbreviation or name of a
U . S . state .
2007-04-08 11:21:00 +00:00
>> > from django . contrib . localflavor . us . forms import USStateField
2007-04-01 04:40:36 +00:00
>> > f = USStateField ( )
>> > f . clean ( ' il ' )
u ' IL '
>> > f . clean ( ' IL ' )
u ' IL '
>> > f . clean ( ' illinois ' )
u ' IL '
>> > f . clean ( ' illinois ' )
u ' IL '
>> > f . clean ( 60606 )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a U.S. state or territory. ' ]
>> > f . clean ( None )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field is required. ' ]
>> > f . clean ( ' ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field is required. ' ]
>> > f = USStateField ( required = False )
>> > f . clean ( ' il ' )
u ' IL '
>> > f . clean ( ' IL ' )
u ' IL '
>> > f . clean ( ' illinois ' )
u ' IL '
>> > f . clean ( ' illinois ' )
u ' IL '
>> > f . clean ( 60606 )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a U.S. state or territory. ' ]
>> > f . clean ( None )
u ' '
>> > f . clean ( ' ' )
u ' '
# USStateSelect ###############################################################
USStateSelect is a Select widget that uses a list of U . S . states / territories
as its choices .
2007-04-08 11:21:00 +00:00
>> > from django . contrib . localflavor . us . forms import USStateSelect
2007-04-01 04:40:36 +00:00
>> > w = USStateSelect ( )
>> > print w . render ( ' state ' , ' IL ' )
< select name = " state " >
< option value = " AL " > Alabama < / option >
< option value = " AK " > Alaska < / option >
< option value = " AS " > American Samoa < / option >
< option value = " AZ " > Arizona < / option >
< option value = " AR " > Arkansas < / option >
< option value = " CA " > California < / option >
< option value = " CO " > Colorado < / option >
< option value = " CT " > Connecticut < / option >
2007-04-10 21:11:08 +00:00
< option value = " DE " > Delaware < / option >
2007-04-01 04:40:36 +00:00
< option value = " DC " > District of Columbia < / option >
< option value = " FM " > Federated States of Micronesia < / option >
< option value = " FL " > Florida < / option >
< option value = " GA " > Georgia < / option >
< option value = " GU " > Guam < / option >
< option value = " HI " > Hawaii < / option >
< option value = " ID " > Idaho < / option >
< option value = " IL " selected = " selected " > Illinois < / option >
< option value = " IN " > Indiana < / option >
< option value = " IA " > Iowa < / option >
< option value = " KS " > Kansas < / option >
< option value = " KY " > Kentucky < / option >
< option value = " LA " > Louisiana < / option >
< option value = " ME " > Maine < / option >
< option value = " MH " > Marshall Islands < / option >
< option value = " MD " > Maryland < / option >
< option value = " MA " > Massachusetts < / option >
< option value = " MI " > Michigan < / option >
< option value = " MN " > Minnesota < / option >
< option value = " MS " > Mississippi < / option >
< option value = " MO " > Missouri < / option >
< option value = " MT " > Montana < / option >
< option value = " NE " > Nebraska < / option >
< option value = " NV " > Nevada < / option >
< option value = " NH " > New Hampshire < / option >
< option value = " NJ " > New Jersey < / option >
< option value = " NM " > New Mexico < / option >
< option value = " NY " > New York < / option >
< option value = " NC " > North Carolina < / option >
< option value = " ND " > North Dakota < / option >
< option value = " MP " > Northern Mariana Islands < / option >
< option value = " OH " > Ohio < / option >
< option value = " OK " > Oklahoma < / option >
< option value = " OR " > Oregon < / option >
< option value = " PW " > Palau < / option >
< option value = " PA " > Pennsylvania < / option >
< option value = " PR " > Puerto Rico < / option >
< option value = " RI " > Rhode Island < / option >
< option value = " SC " > South Carolina < / option >
< option value = " SD " > South Dakota < / option >
< option value = " TN " > Tennessee < / option >
< option value = " TX " > Texas < / option >
< option value = " UT " > Utah < / option >
< option value = " VT " > Vermont < / option >
< option value = " VI " > Virgin Islands < / option >
< option value = " VA " > Virginia < / option >
< option value = " WA " > Washington < / option >
< option value = " WV " > West Virginia < / option >
< option value = " WI " > Wisconsin < / option >
< option value = " WY " > Wyoming < / option >
< / select >
2007-04-03 03:56:17 +00:00
# USSocialSecurityNumberField #################################################
2007-04-08 11:21:00 +00:00
>> > from django . contrib . localflavor . us . forms import USSocialSecurityNumberField
2007-04-03 03:56:17 +00:00
>> > f = USSocialSecurityNumberField ( )
>> > f . clean ( ' 987-65-4330 ' )
u ' 987-65-4330 '
>> > f . clean ( ' 987654330 ' )
u ' 987-65-4330 '
>> > f . clean ( ' 078-05-1120 ' )
Traceback ( most recent call last ) :
. . .
2007-04-03 22:33:28 +00:00
ValidationError : [ u ' Enter a valid U.S. Social Security number in XXX-XX-XXXX format. ' ]
2007-04-03 03:56:17 +00:00
2007-04-01 04:40:36 +00:00
# UKPostcodeField #############################################################
UKPostcodeField validates that the data is a valid UK postcode .
>> > from django . contrib . localflavor . uk . forms import UKPostcodeField
>> > f = UKPostcodeField ( )
>> > f . clean ( ' BT32 4PX ' )
u ' BT32 4PX '
>> > f . clean ( ' GIR 0AA ' )
u ' GIR 0AA '
>> > f . clean ( ' BT324PX ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a postcode. A space is required between the two postcode parts. ' ]
>> > f . clean ( ' 1NV 4L1D ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a postcode. A space is required between the two postcode parts. ' ]
>> > f . clean ( None )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field is required. ' ]
>> > f . clean ( ' ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field is required. ' ]
>> > f = UKPostcodeField ( required = False )
>> > f . clean ( ' BT32 4PX ' )
u ' BT32 4PX '
>> > f . clean ( ' GIR 0AA ' )
u ' GIR 0AA '
>> > f . clean ( ' 1NV 4L1D ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a postcode. A space is required between the two postcode parts. ' ]
>> > f . clean ( ' BT324PX ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a postcode. A space is required between the two postcode parts. ' ]
>> > f . clean ( None )
u ' '
>> > f . clean ( ' ' )
u ' '
# FRZipCodeField #############################################################
FRZipCodeField validates that the data is a valid FR zipcode .
>> > from django . contrib . localflavor . fr . forms import FRZipCodeField
>> > f = FRZipCodeField ( )
>> > f . clean ( ' 75001 ' )
u ' 75001 '
>> > f . clean ( ' 93200 ' )
u ' 93200 '
>> > f . clean ( ' 2A200 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a zip code in the format XXXXX. ' ]
>> > f . clean ( ' 980001 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a zip code in the format XXXXX. ' ]
>> > f . clean ( None )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field is required. ' ]
>> > f . clean ( ' ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field is required. ' ]
>> > f = FRZipCodeField ( required = False )
>> > f . clean ( ' 75001 ' )
u ' 75001 '
>> > f . clean ( ' 93200 ' )
u ' 93200 '
>> > f . clean ( ' 2A200 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a zip code in the format XXXXX. ' ]
>> > f . clean ( ' 980001 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a zip code in the format XXXXX. ' ]
>> > f . clean ( None )
u ' '
>> > f . clean ( ' ' )
u ' '
# FRPhoneNumberField ##########################################################
FRPhoneNumberField validates that the data is a valid french phone number .
It ' s normalized to 0X XX XX XX XX format. Dots are valid too.
>> > from django . contrib . localflavor . fr . forms import FRPhoneNumberField
>> > f = FRPhoneNumberField ( )
>> > f . clean ( ' 01 55 44 58 64 ' )
u ' 01 55 44 58 64 '
>> > f . clean ( ' 0155445864 ' )
u ' 01 55 44 58 64 '
>> > f . clean ( ' 01 5544 5864 ' )
u ' 01 55 44 58 64 '
>> > f . clean ( ' 01 55.44.58.64 ' )
u ' 01 55 44 58 64 '
>> > f . clean ( ' 01.55.44.58.64 ' )
u ' 01 55 44 58 64 '
>> > f . clean ( ' 01,55,44,58,64 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Phone numbers must be in 0X XX XX XX XX format. ' ]
>> > f . clean ( ' 555 015 544 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Phone numbers must be in 0X XX XX XX XX format. ' ]
>> > f . clean ( None )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field is required. ' ]
>> > f . clean ( ' ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field is required. ' ]
>> > f = FRPhoneNumberField ( required = False )
>> > f . clean ( ' 01 55 44 58 64 ' )
u ' 01 55 44 58 64 '
>> > f . clean ( ' 0155445864 ' )
u ' 01 55 44 58 64 '
>> > f . clean ( ' 01 5544 5864 ' )
u ' 01 55 44 58 64 '
>> > f . clean ( ' 01 55.44.58.64 ' )
u ' 01 55 44 58 64 '
>> > f . clean ( ' 01.55.44.58.64 ' )
u ' 01 55 44 58 64 '
>> > f . clean ( ' 01,55,44,58,64 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Phone numbers must be in 0X XX XX XX XX format. ' ]
>> > f . clean ( ' 555 015 544 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Phone numbers must be in 0X XX XX XX XX format. ' ]
>> > f . clean ( None )
u ' '
>> > f . clean ( ' ' )
u ' '
# FRDepartmentSelect ###############################################################
2007-04-06 04:24:06 +00:00
FRDepartmentSelect is a Select widget that uses a list of french departments
2007-04-01 04:40:36 +00:00
including DOM TOM
>> > from django . contrib . localflavor . fr . forms import FRDepartmentSelect
>> > w = FRDepartmentSelect ( )
>> > print w . render ( ' dep ' , ' Paris ' )
< select name = " dep " >
< option value = " 01 " > 01 - Ain < / option >
< option value = " 02 " > 02 - Aisne < / option >
< option value = " 03 " > 03 - Allier < / option >
< option value = " 04 " > 04 - Alpes - de - Haute - Provence < / option >
< option value = " 05 " > 05 - Hautes - Alpes < / option >
< option value = " 06 " > 06 - Alpes - Maritimes < / option >
< option value = " 07 " > 07 - Ardeche < / option >
< option value = " 08 " > 08 - Ardennes < / option >
< option value = " 09 " > 09 - Ariege < / option >
< option value = " 10 " > 10 - Aube < / option >
< option value = " 11 " > 11 - Aude < / option >
< option value = " 12 " > 12 - Aveyron < / option >
< option value = " 13 " > 13 - Bouches - du - Rhone < / option >
< option value = " 14 " > 14 - Calvados < / option >
< option value = " 15 " > 15 - Cantal < / option >
< option value = " 16 " > 16 - Charente < / option >
< option value = " 17 " > 17 - Charente - Maritime < / option >
< option value = " 18 " > 18 - Cher < / option >
< option value = " 19 " > 19 - Correze < / option >
< option value = " 21 " > 21 - Cote - d & #39;Or</option>
< option value = " 22 " > 22 - Cotes - d & #39;Armor</option>
< option value = " 23 " > 23 - Creuse < / option >
< option value = " 24 " > 24 - Dordogne < / option >
< option value = " 25 " > 25 - Doubs < / option >
< option value = " 26 " > 26 - Drome < / option >
< option value = " 27 " > 27 - Eure < / option >
< option value = " 28 " > 28 - Eure - et - Loire < / option >
< option value = " 29 " > 29 - Finistere < / option >
< option value = " 2A " > 2 A - Corse - du - Sud < / option >
< option value = " 2B " > 2 B - Haute - Corse < / option >
< option value = " 30 " > 30 - Gard < / option >
< option value = " 31 " > 31 - Haute - Garonne < / option >
< option value = " 32 " > 32 - Gers < / option >
< option value = " 33 " > 33 - Gironde < / option >
< option value = " 34 " > 34 - Herault < / option >
< option value = " 35 " > 35 - Ille - et - Vilaine < / option >
< option value = " 36 " > 36 - Indre < / option >
< option value = " 37 " > 37 - Indre - et - Loire < / option >
< option value = " 38 " > 38 - Isere < / option >
< option value = " 39 " > 39 - Jura < / option >
< option value = " 40 " > 40 - Landes < / option >
< option value = " 41 " > 41 - Loir - et - Cher < / option >
< option value = " 42 " > 42 - Loire < / option >
< option value = " 43 " > 43 - Haute - Loire < / option >
< option value = " 44 " > 44 - Loire - Atlantique < / option >
< option value = " 45 " > 45 - Loiret < / option >
< option value = " 46 " > 46 - Lot < / option >
< option value = " 47 " > 47 - Lot - et - Garonne < / option >
< option value = " 48 " > 48 - Lozere < / option >
< option value = " 49 " > 49 - Maine - et - Loire < / option >
< option value = " 50 " > 50 - Manche < / option >
< option value = " 51 " > 51 - Marne < / option >
< option value = " 52 " > 52 - Haute - Marne < / option >
< option value = " 53 " > 53 - Mayenne < / option >
< option value = " 54 " > 54 - Meurthe - et - Moselle < / option >
< option value = " 55 " > 55 - Meuse < / option >
< option value = " 56 " > 56 - Morbihan < / option >
< option value = " 57 " > 57 - Moselle < / option >
< option value = " 58 " > 58 - Nievre < / option >
< option value = " 59 " > 59 - Nord < / option >
< option value = " 60 " > 60 - Oise < / option >
< option value = " 61 " > 61 - Orne < / option >
< option value = " 62 " > 62 - Pas - de - Calais < / option >
< option value = " 63 " > 63 - Puy - de - Dome < / option >
< option value = " 64 " > 64 - Pyrenees - Atlantiques < / option >
< option value = " 65 " > 65 - Hautes - Pyrenees < / option >
< option value = " 66 " > 66 - Pyrenees - Orientales < / option >
< option value = " 67 " > 67 - Bas - Rhin < / option >
< option value = " 68 " > 68 - Haut - Rhin < / option >
< option value = " 69 " > 69 - Rhone < / option >
< option value = " 70 " > 70 - Haute - Saone < / option >
< option value = " 71 " > 71 - Saone - et - Loire < / option >
< option value = " 72 " > 72 - Sarthe < / option >
< option value = " 73 " > 73 - Savoie < / option >
< option value = " 74 " > 74 - Haute - Savoie < / option >
< option value = " 75 " > 75 - Paris < / option >
< option value = " 76 " > 76 - Seine - Maritime < / option >
< option value = " 77 " > 77 - Seine - et - Marne < / option >
< option value = " 78 " > 78 - Yvelines < / option >
< option value = " 79 " > 79 - Deux - Sevres < / option >
< option value = " 80 " > 80 - Somme < / option >
< option value = " 81 " > 81 - Tarn < / option >
< option value = " 82 " > 82 - Tarn - et - Garonne < / option >
< option value = " 83 " > 83 - Var < / option >
< option value = " 84 " > 84 - Vaucluse < / option >
< option value = " 85 " > 85 - Vendee < / option >
< option value = " 86 " > 86 - Vienne < / option >
< option value = " 87 " > 87 - Haute - Vienne < / option >
< option value = " 88 " > 88 - Vosges < / option >
< option value = " 89 " > 89 - Yonne < / option >
< option value = " 90 " > 90 - Territoire de Belfort < / option >
< option value = " 91 " > 91 - Essonne < / option >
< option value = " 92 " > 92 - Hauts - de - Seine < / option >
< option value = " 93 " > 93 - Seine - Saint - Denis < / option >
< option value = " 94 " > 94 - Val - de - Marne < / option >
< option value = " 95 " > 95 - Val - d & #39;Oise</option>
< option value = " 2A " > 2 A - Corse du sud < / option >
< option value = " 2B " > 2 B - Haute Corse < / option >
< option value = " 971 " > 971 - Guadeloupe < / option >
< option value = " 972 " > 972 - Martinique < / option >
< option value = " 973 " > 973 - Guyane < / option >
< option value = " 974 " > 974 - La Reunion < / option >
< option value = " 975 " > 975 - Saint - Pierre - et - Miquelon < / option >
< option value = " 976 " > 976 - Mayotte < / option >
< option value = " 984 " > 984 - Terres Australes et Antarctiques < / option >
< option value = " 986 " > 986 - Wallis et Futuna < / option >
< option value = " 987 " > 987 - Polynesie Francaise < / option >
< option value = " 988 " > 988 - Nouvelle - Caledonie < / option >
< / select >
# JPPostalCodeField ###############################################################
A form field that validates its input is a Japanese postcode .
Accepts 7 digits ( with / out hyphen ) .
>> > from django . contrib . localflavor . jp . forms import JPPostalCodeField
>> > f = JPPostalCodeField ( )
>> > f . clean ( ' 251-0032 ' )
u ' 2510032 '
>> > f . clean ( ' 2510032 ' )
u ' 2510032 '
>> > f . clean ( ' 2510-032 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a postal code in the format XXXXXXX or XXX-XXXX. ' ]
>> > f . clean ( ' 251a0032 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a postal code in the format XXXXXXX or XXX-XXXX. ' ]
>> > f . clean ( ' a51-0032 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a postal code in the format XXXXXXX or XXX-XXXX. ' ]
>> > f . clean ( ' 25100321 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a postal code in the format XXXXXXX or XXX-XXXX. ' ]
>> > f . clean ( ' ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field is required. ' ]
>> > f = JPPostalCodeField ( required = False )
>> > f . clean ( ' 251-0032 ' )
u ' 2510032 '
>> > f . clean ( ' 2510032 ' )
u ' 2510032 '
>> > f . clean ( ' 2510-032 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a postal code in the format XXXXXXX or XXX-XXXX. ' ]
>> > f . clean ( ' ' )
u ' '
>> > f . clean ( None )
u ' '
# JPPrefectureSelect ###############################################################
A Select widget that uses a list of Japanese prefectures as its choices .
>> > from django . contrib . localflavor . jp . forms import JPPrefectureSelect
>> > w = JPPrefectureSelect ( )
>> > print w . render ( ' prefecture ' , ' kanagawa ' )
< select name = " prefecture " >
< option value = " hokkaido " > Hokkaido < / option >
< option value = " aomori " > Aomori < / option >
< option value = " iwate " > Iwate < / option >
< option value = " miyagi " > Miyagi < / option >
< option value = " akita " > Akita < / option >
< option value = " yamagata " > Yamagata < / option >
< option value = " fukushima " > Fukushima < / option >
< option value = " ibaraki " > Ibaraki < / option >
< option value = " tochigi " > Tochigi < / option >
< option value = " gunma " > Gunma < / option >
< option value = " saitama " > Saitama < / option >
< option value = " chiba " > Chiba < / option >
< option value = " tokyo " > Tokyo < / option >
< option value = " kanagawa " selected = " selected " > Kanagawa < / option >
< option value = " yamanashi " > Yamanashi < / option >
< option value = " nagano " > Nagano < / option >
< option value = " niigata " > Niigata < / option >
< option value = " toyama " > Toyama < / option >
< option value = " ishikawa " > Ishikawa < / option >
< option value = " fukui " > Fukui < / option >
< option value = " gifu " > Gifu < / option >
< option value = " shizuoka " > Shizuoka < / option >
< option value = " aichi " > Aichi < / option >
< option value = " mie " > Mie < / option >
< option value = " shiga " > Shiga < / option >
< option value = " kyoto " > Kyoto < / option >
< option value = " osaka " > Osaka < / option >
< option value = " hyogo " > Hyogo < / option >
< option value = " nara " > Nara < / option >
< option value = " wakayama " > Wakayama < / option >
< option value = " tottori " > Tottori < / option >
< option value = " shimane " > Shimane < / option >
< option value = " okayama " > Okayama < / option >
< option value = " hiroshima " > Hiroshima < / option >
< option value = " yamaguchi " > Yamaguchi < / option >
< option value = " tokushima " > Tokushima < / option >
< option value = " kagawa " > Kagawa < / option >
< option value = " ehime " > Ehime < / option >
< option value = " kochi " > Kochi < / option >
< option value = " fukuoka " > Fukuoka < / option >
< option value = " saga " > Saga < / option >
< option value = " nagasaki " > Nagasaki < / option >
< option value = " kumamoto " > Kumamoto < / option >
< option value = " oita " > Oita < / option >
< option value = " miyazaki " > Miyazaki < / option >
< option value = " kagoshima " > Kagoshima < / option >
< option value = " okinawa " > Okinawa < / option >
< / select >
# ITZipCodeField #############################################################
>> > from django . contrib . localflavor . it . forms import ITZipCodeField
>> > f = ITZipCodeField ( )
>> > f . clean ( ' 00100 ' )
u ' 00100 '
>> > f . clean ( ' 00100 ' )
Traceback ( most recent call last ) :
. . .
2007-04-17 13:37:45 +00:00
ValidationError : [ u ' Enter a valid zip code. ' ]
2007-04-01 04:40:36 +00:00
# ITRegionSelect #############################################################
>> > from django . contrib . localflavor . it . forms import ITRegionSelect
>> > w = ITRegionSelect ( )
>> > w . render ( ' regions ' , ' PMN ' )
u ' <select name= " regions " > \n <option value= " ABR " >Abruzzo</option> \n <option value= " BAS " >Basilicata</option> \n <option value= " CAL " >Calabria</option> \n <option value= " CAM " >Campania</option> \n <option value= " EMR " >Emilia-Romagna</option> \n <option value= " FVG " >Friuli-Venezia Giulia</option> \n <option value= " LAZ " >Lazio</option> \n <option value= " LIG " >Liguria</option> \n <option value= " LOM " >Lombardia</option> \n <option value= " MAR " >Marche</option> \n <option value= " MOL " >Molise</option> \n <option value= " PMN " selected= " selected " >Piemonte</option> \n <option value= " PUG " >Puglia</option> \n <option value= " SAR " >Sardegna</option> \n <option value= " SIC " >Sicilia</option> \n <option value= " TOS " >Toscana</option> \n <option value= " TAA " >Trentino-Alto Adige</option> \n <option value= " UMB " >Umbria</option> \n <option value= " VAO " >Valle d \u2019 Aosta</option> \n <option value= " VEN " >Veneto</option> \n </select> '
2007-04-17 13:37:45 +00:00
# ITSocialSecurityNumberField #################################################
>> > from django . contrib . localflavor . it . forms import ITSocialSecurityNumberField
>> > f = ITSocialSecurityNumberField ( )
>> > f . clean ( ' LVSGDU99T71H501L ' )
u ' LVSGDU99T71H501L '
>> > f . clean ( ' LBRRME11A01L736W ' )
u ' LBRRME11A01L736W '
>> > f . clean ( ' lbrrme11a01l736w ' )
u ' LBRRME11A01L736W '
>> > f . clean ( ' LBR RME 11A01 L736W ' )
u ' LBRRME11A01L736W '
>> > f . clean ( ' LBRRME11A01L736A ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a valid Social Security number. ' ]
>> > f . clean ( ' % BRRME11A01L736W ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a valid Social Security number. ' ]
# ITVatNumberField ###########################################################
>> > from django . contrib . localflavor . it . forms import ITVatNumberField
>> > f = ITVatNumberField ( )
>> > f . clean ( ' 07973780013 ' )
u ' 07973780013 '
>> > f . clean ( ' 7973780013 ' )
u ' 07973780013 '
>> > f . clean ( 7973780013 )
u ' 07973780013 '
>> > f . clean ( ' 07973780014 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a valid VAT number. ' ]
>> > f . clean ( ' A7973780013 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a valid VAT number. ' ]
2007-04-01 04:40:36 +00:00
# FIZipCodeField #############################################################
FIZipCodeField validates that the data is a valid FI zipcode .
>> > from django . contrib . localflavor . fi . forms import FIZipCodeField
>> > f = FIZipCodeField ( )
>> > f . clean ( ' 20540 ' )
u ' 20540 '
>> > f . clean ( ' 20101 ' )
u ' 20101 '
>> > f . clean ( ' 20s40 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a zip code in the format XXXXX. ' ]
>> > f . clean ( ' 205401 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a zip code in the format XXXXX. ' ]
>> > f . clean ( None )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field is required. ' ]
>> > f . clean ( ' ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field is required. ' ]
>> > f = FIZipCodeField ( required = False )
>> > f . clean ( ' 20540 ' )
u ' 20540 '
>> > f . clean ( ' 20101 ' )
u ' 20101 '
>> > f . clean ( ' 20s40 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a zip code in the format XXXXX. ' ]
>> > f . clean ( ' 205401 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a zip code in the format XXXXX. ' ]
>> > f . clean ( None )
u ' '
>> > f . clean ( ' ' )
u ' '
2007-04-06 04:24:06 +00:00
# FIMunicipalitySelect ###############################################################
2007-04-01 04:40:36 +00:00
2007-04-06 04:24:06 +00:00
A Select widget that uses a list of Finnish municipalities as its choices .
>> > from django . contrib . localflavor . fi . forms import FIMunicipalitySelect
>> > w = FIMunicipalitySelect ( )
2007-04-01 04:40:36 +00:00
>> > unicode ( w . render ( ' municipalities ' , ' turku ' ) )
u ' <select name= " municipalities " > \n <option value= " akaa " >Akaa</option> \n <option value= " alaharma " >Alah \xe4 rm \xe4 </option> \n <option value= " alajarvi " >Alaj \xe4 rvi</option> \n <option value= " alastaro " >Alastaro</option> \n <option value= " alavieska " >Alavieska</option> \n <option value= " alavus " >Alavus</option> \n <option value= " anjalankoski " >Anjalankoski</option> \n <option value= " artjarvi " >Artj \xe4 rvi</option> \n <option value= " asikkala " >Asikkala</option> \n <option value= " askainen " >Askainen</option> \n <option value= " askola " >Askola</option> \n <option value= " aura " >Aura</option> \n <option value= " brando " >Br \xe4 nd \xf6 </option> \n <option value= " dragsfjard " >Dragsfj \xe4 rd</option> \n <option value= " eckero " >Ecker \xf6 </option> \n <option value= " elimaki " >Elim \xe4 ki</option> \n <option value= " eno " >Eno</option> \n <option value= " enonkoski " >Enonkoski</option> \n <option value= " enontekio " >Enonteki \xf6 </option> \n <option value= " espoo " >Espoo</option> \n <option value= " eura " >Eura</option> \n <option value= " eurajoki " >Eurajoki</option> \n <option value= " evijarvi " >Evij \xe4 rvi</option> \n <option value= " finstrom " >Finstr \xf6 m</option> \n <option value= " forssa " >Forssa</option> \n <option value= " foglo " >F \xf6 gl \xf6 </option> \n <option value= " geta " >Geta</option> \n <option value= " haapajarvi " >Haapaj \xe4 rvi</option> \n <option value= " haapavesi " >Haapavesi</option> \n <option value= " hailuoto " >Hailuoto</option> \n <option value= " halikko " >Halikko</option> \n <option value= " halsua " >Halsua</option> \n <option value= " hamina " >Hamina</option> \n <option value= " hammarland " >Hammarland</option> \n <option value= " hankasalmi " >Hankasalmi</option> \n <option value= " hanko " >Hanko</option> \n <option value= " harjavalta " >Harjavalta</option> \n <option value= " hartola " >Hartola</option> \n <option value= " hattula " >Hattula</option> \n <option value= " hauho " >Hauho</option> \n <option value= " haukipudas " >Haukipudas</option> \n <option value= " hausjarvi " >Hausj \xe4 rvi</option> \n <option value= " heinola " >Heinola</option> \n <option value= " heinavesi " >Hein \xe4 vesi</option> \n <option value= " helsinki " >Helsinki</option> \n <option value= " himanka " >Himanka</option> \n <option value= " hirvensalmi " >Hirvensalmi</option> \n <option value= " hollola " >Hollola</option> \n <option value= " honkajoki " >Honkajoki</option> \n <option value= " houtskari " >Houtskari</option> \n <option value= " huittinen " >Huittinen</option> \n <option value= " humppila " >Humppila</option> \n <option value= " hyrynsalmi " >Hyrynsalmi</option> \n <option value= " hyvinkaa " >Hyvink \xe4 \xe4 </option> \n <option value= " hameenkoski " >H \xe4 meenkoski</option> \n <option value= " hameenkyro " >H \xe4 meenkyr \xf6 </option> \n <option value= " hameenlinna " >H \xe4 meenlinna</option> \n <option value= " ii " >Ii</option> \n <option value= " iisalmi " >Iisalmi</option> \n <option value= " iitti " >Iitti</option> \n <option value= " ikaalinen " >Ikaalinen</option> \n <option value= " ilmajoki " >Ilmajoki</option> \n <option value= " ilomantsi " >Ilomantsi</option> \n <option value= " imatra " >Imatra</option> \n <option value= " inari " >Inari</option> \n <option value= " inio " >Ini \xf6 </option> \n <option value= " inkoo " >Inkoo</option> \n <option value= " isojoki " >Isojoki</option> \n <option value= " isokyro " >Isokyr \xf6 </option> \n <option value= " jaala " >Jaala</option> \n <option value= " jalasjarvi " >Jalasj \xe4 rvi</option> \n <option value= " janakkala " >Janakkala</option> \n <option value= " joensuu " >Joensuu</option> \n <option value= " jokioinen " >Jokioinen</option> \n <option value= " jomala " >Jomala</option> \n <option value= " joroinen " >Joroinen</option> \n <option value= " joutsa " >Joutsa</option> \n <option value= " joutseno " >Joutseno</option> \n <option value= " juankoski " >Juankoski</option> \n <option value= " jurva " >Jurva</option> \n <option value= " juuka " >Juuka</option> \n <option value= " juupajoki " >Juupajoki</option> \n <option value= " juva " >Juva</option> \n <option value= " jyvaskyla " >Jyv \xe4 skyl \xe4 </option> \n <option value= " jyvaskylan_mlk " >Jyv \xe4 skyl \xe4 n maalaiskunta</option> \n <option value= " jamijarvi " >J \xe4 mij \xe4 rvi</option> \n <option value= " jamsa " >J \xe4 ms \xe4 </option> \n <option value= " jamsankoski " >J \xe4 ms \xe4 nkoski</option> \n <option value= " jarvenpaa " >J \xe4 rvenp \xe4 \xe4 </option> \n <option value= " kaarina " >Kaarina</option> \n <option value= " kaavi " >Kaavi</option> \n <option value= " kajaan
# FISocialSecurityNumber
##############################################################
>> > from django . contrib . localflavor . fi . forms import FISocialSecurityNumber
>> > f = FISocialSecurityNumber ( )
>> > f . clean ( ' 010101-0101 ' )
u ' 010101-0101 '
>> > f . clean ( ' 010101+0101 ' )
u ' 010101+0101 '
>> > f . clean ( ' 010101A0101 ' )
u ' 010101A0101 '
>> > f . clean ( ' 101010-0102 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a valid Finnish social security number. ' ]
>> > f . clean ( ' 10a010-0101 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a valid Finnish social security number. ' ]
>> > f . clean ( ' 101010-0 \xe4 01 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a valid Finnish social security number. ' ]
>> > f . clean ( ' 101010b0101 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a valid Finnish social security number. ' ]
>> > f . clean ( ' ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field is required. ' ]
>> > f . clean ( None )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field is required. ' ]
>> > f = FISocialSecurityNumber ( required = False )
>> > f . clean ( ' 010101-0101 ' )
u ' 010101-0101 '
>> > f . clean ( None )
u ' '
>> > f . clean ( ' ' )
u ' '
# BRZipCodeField ############################################################
>> > from django . contrib . localflavor . br . forms import BRZipCodeField
>> > f = BRZipCodeField ( )
>> > f . clean ( ' 12345-123 ' )
u ' 12345-123 '
>> > f . clean ( ' 12345_123 ' )
Traceback ( most recent call last ) :
. . .
2007-04-03 03:13:21 +00:00
ValidationError : [ u ' Enter a zip code in the format XXXXX-XXX. ' ]
2007-04-01 04:40:36 +00:00
>> > f . clean ( ' 1234-123 ' )
Traceback ( most recent call last ) :
. . .
2007-04-03 03:13:21 +00:00
ValidationError : [ u ' Enter a zip code in the format XXXXX-XXX. ' ]
2007-04-01 04:40:36 +00:00
>> > f . clean ( ' abcde-abc ' )
Traceback ( most recent call last ) :
. . .
2007-04-03 03:13:21 +00:00
ValidationError : [ u ' Enter a zip code in the format XXXXX-XXX. ' ]
2007-04-01 04:40:36 +00:00
>> > f . clean ( ' 12345- ' )
Traceback ( most recent call last ) :
. . .
2007-04-03 03:13:21 +00:00
ValidationError : [ u ' Enter a zip code in the format XXXXX-XXX. ' ]
2007-04-01 04:40:36 +00:00
>> > f . clean ( ' -123 ' )
Traceback ( most recent call last ) :
. . .
2007-04-03 03:13:21 +00:00
ValidationError : [ u ' Enter a zip code in the format XXXXX-XXX. ' ]
2007-04-01 04:40:36 +00:00
>> > f . clean ( ' ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field is required. ' ]
>> > f . clean ( None )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field is required. ' ]
>> > f = BRZipCodeField ( required = False )
>> > f . clean ( None )
u ' '
>> > f . clean ( ' ' )
u ' '
>> > f . clean ( ' -123 ' )
Traceback ( most recent call last ) :
. . .
2007-04-03 03:13:21 +00:00
ValidationError : [ u ' Enter a zip code in the format XXXXX-XXX. ' ]
2007-04-01 04:40:36 +00:00
>> > f . clean ( ' 12345- ' )
Traceback ( most recent call last ) :
. . .
2007-04-03 03:13:21 +00:00
ValidationError : [ u ' Enter a zip code in the format XXXXX-XXX. ' ]
2007-04-01 04:40:36 +00:00
>> > f . clean ( ' abcde-abc ' )
Traceback ( most recent call last ) :
. . .
2007-04-03 03:13:21 +00:00
ValidationError : [ u ' Enter a zip code in the format XXXXX-XXX. ' ]
2007-04-01 04:40:36 +00:00
>> > f . clean ( ' 1234-123 ' )
Traceback ( most recent call last ) :
. . .
2007-04-03 03:13:21 +00:00
ValidationError : [ u ' Enter a zip code in the format XXXXX-XXX. ' ]
2007-04-01 04:40:36 +00:00
>> > f . clean ( ' 12345_123 ' )
Traceback ( most recent call last ) :
. . .
2007-04-03 03:13:21 +00:00
ValidationError : [ u ' Enter a zip code in the format XXXXX-XXX. ' ]
2007-04-01 04:40:36 +00:00
>> > f . clean ( ' 12345-123 ' )
u ' 12345-123 '
2007-04-26 13:11:07 +00:00
# BRCNPJField ############################################################
>> > from django . contrib . localflavor . br . forms import BRCNPJField
>> > f = BRCNPJField ( required = True )
>> > f . clean ( ' ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field is required. ' ]
>> > f . clean ( ' 12-345-678/9012-10 ' )
Traceback ( most recent call last ) :
. . .
2007-04-26 15:05:47 +00:00
ValidationError : [ u ' Invalid CNPJ number. ' ]
2007-04-26 13:11:07 +00:00
>> > f . clean ( ' 12.345.678/9012-10 ' )
Traceback ( most recent call last ) :
. . .
2007-04-26 15:05:47 +00:00
ValidationError : [ u ' Invalid CNPJ number. ' ]
2007-04-26 13:11:07 +00:00
>> > f . clean ( ' 12345678/9012-10 ' )
Traceback ( most recent call last ) :
. . .
2007-04-26 15:05:47 +00:00
ValidationError : [ u ' Invalid CNPJ number. ' ]
2007-04-26 13:11:07 +00:00
>> > f . clean ( ' 64.132.916/0001-88 ' )
' 64.132.916/0001-88 '
>> > f . clean ( ' 64-132-916/0001-88 ' )
' 64-132-916/0001-88 '
>> > f . clean ( ' 64132916/0001-88 ' )
' 64132916/0001-88 '
>> > f . clean ( ' 64.132.916/0001-XX ' )
Traceback ( most recent call last ) :
. . .
2007-04-26 15:05:47 +00:00
ValidationError : [ u ' This field requires only numbers. ' ]
2007-04-26 13:11:07 +00:00
>> > f = BRCNPJField ( required = False )
>> > f . clean ( ' ' )
u ' '
2007-04-27 12:50:24 +00:00
# BRCPFField #################################################################
>> > from django . contrib . localflavor . br . forms import BRCPFField
>> > f = BRCPFField ( )
>> > f . clean ( ' ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field is required. ' ]
>> > f . clean ( None )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field is required. ' ]
>> > f . clean ( ' 489.294.654-54 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Invalid CPF number. ' ]
>> > f . clean ( ' 295.669.575-98 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Invalid CPF number. ' ]
>> > f . clean ( ' 539.315.127-22 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Invalid CPF number. ' ]
>> > f . clean ( ' 663.256.017-26 ' )
u ' 663.256.017-26 '
>> > f . clean ( ' 66325601726 ' )
u ' 66325601726 '
>> > f . clean ( ' 375.788.573-20 ' )
u ' 375.788.573-20 '
>> > f . clean ( ' 84828509895 ' )
u ' 84828509895 '
>> > f . clean ( ' 375.788.573-XX ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field requires only numbers. ' ]
>> > f . clean ( ' 375.788.573-000 ' )
Traceback ( most recent call last ) :
. . .
2007-07-13 14:13:35 +00:00
ValidationError : [ u ' Ensure this value has at most 14 characters (it has 15). ' ]
2007-04-27 12:50:24 +00:00
>> > f . clean ( ' 123.456.78 ' )
Traceback ( most recent call last ) :
. . .
2007-07-13 14:13:35 +00:00
ValidationError : [ u ' Ensure this value has at least 11 characters (it has 10). ' ]
2007-04-27 12:50:24 +00:00
>> > f . clean ( ' 123456789555 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field requires at most 11 digits or 14 characters. ' ]
>> > f = BRCPFField ( required = False )
>> > f . clean ( ' ' )
u ' '
>> > f . clean ( None )
u ' '
2007-04-01 04:40:36 +00:00
# BRPhoneNumberField #########################################################
>> > from django . contrib . localflavor . br . forms import BRPhoneNumberField
>> > f = BRPhoneNumberField ( )
>> > f . clean ( ' 41-3562-3464 ' )
u ' 41-3562-3464 '
>> > f . clean ( ' 4135623464 ' )
u ' 41-3562-3464 '
>> > f . clean ( ' 41 3562-3464 ' )
u ' 41-3562-3464 '
>> > f . clean ( ' 41 3562 3464 ' )
u ' 41-3562-3464 '
>> > f . clean ( ' (41) 3562 3464 ' )
u ' 41-3562-3464 '
>> > f . clean ( ' 41.3562.3464 ' )
u ' 41-3562-3464 '
>> > f . clean ( ' 41.3562-3464 ' )
u ' 41-3562-3464 '
>> > f . clean ( ' (41) 3562.3464 ' )
u ' 41-3562-3464 '
>> > f . clean ( None )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field is required. ' ]
>> > f . clean ( ' ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field is required. ' ]
>> > f = BRPhoneNumberField ( required = False )
>> > f . clean ( ' ' )
u ' '
>> > f . clean ( None )
u ' '
>> > f . clean ( ' (41) 3562.3464 ' )
u ' 41-3562-3464 '
>> > f . clean ( ' 41.3562-3464 ' )
u ' 41-3562-3464 '
>> > f . clean ( ' (41) 3562 3464 ' )
u ' 41-3562-3464 '
>> > f . clean ( ' 4135623464 ' )
u ' 41-3562-3464 '
>> > f . clean ( ' 41 3562-3464 ' )
u ' 41-3562-3464 '
# BRStateSelect ##############################################################
>> > from django . contrib . localflavor . br . forms import BRStateSelect
>> > w = BRStateSelect ( )
>> > w . render ( ' states ' , ' PR ' )
u ' <select name= " states " > \n <option value= " AC " >Acre</option> \n <option value= " AL " >Alagoas</option> \n <option value= " AP " >Amap \xe1 </option> \n <option value= " AM " >Amazonas</option> \n <option value= " BA " >Bahia</option> \n <option value= " CE " >Cear \xe1 </option> \n <option value= " DF " >Distrito Federal</option> \n <option value= " ES " >Esp \xed rito Santo</option> \n <option value= " GO " >Goi \xe1 s</option> \n <option value= " MA " >Maranh \xe3 o</option> \n <option value= " MT " >Mato Grosso</option> \n <option value= " MS " >Mato Grosso do Sul</option> \n <option value= " MG " >Minas Gerais</option> \n <option value= " PA " >Par \xe1 </option> \n <option value= " PB " >Para \xed ba</option> \n <option value= " PR " selected= " selected " >Paran \xe1 </option> \n <option value= " PE " >Pernambuco</option> \n <option value= " PI " >Piau \xed </option> \n <option value= " RJ " >Rio de Janeiro</option> \n <option value= " RN " >Rio Grande do Norte</option> \n <option value= " RS " >Rio Grande do Sul</option> \n <option value= " RO " >Rond \xf4 nia</option> \n <option value= " RR " >Roraima</option> \n <option value= " SC " >Santa Catarina</option> \n <option value= " SP " >S \xe3 o Paulo</option> \n <option value= " SE " >Sergipe</option> \n <option value= " TO " >Tocantins</option> \n </select> '
2007-04-04 06:45:29 +00:00
# DEZipCodeField ##############################################################
>> > from django . contrib . localflavor . de . forms import DEZipCodeField
>> > f = DEZipCodeField ( )
>> > f . clean ( ' 99423 ' )
u ' 99423 '
>> > f . clean ( ' 99423 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a zip code in the format XXXXX. ' ]
# DEStateSelect #############################################################
>> > from django . contrib . localflavor . de . forms import DEStateSelect
>> > w = DEStateSelect ( )
>> > w . render ( ' states ' , ' TH ' )
2007-04-04 15:15:51 +00:00
u ' <select name= " states " > \n <option value= " BW " >Baden-Wuerttemberg</option> \n <option value= " BY " >Bavaria</option> \n <option value= " BE " >Berlin</option> \n <option value= " BB " >Brandenburg</option> \n <option value= " HB " >Bremen</option> \n <option value= " HH " >Hamburg</option> \n <option value= " HE " >Hessen</option> \n <option value= " MV " >Mecklenburg-Western Pomerania</option> \n <option value= " NI " >Lower Saxony</option> \n <option value= " NW " >North Rhine-Westphalia</option> \n <option value= " RP " >Rhineland-Palatinate</option> \n <option value= " SL " >Saarland</option> \n <option value= " SN " >Saxony</option> \n <option value= " ST " >Saxony-Anhalt</option> \n <option value= " SH " >Schleswig-Holstein</option> \n <option value= " TH " selected= " selected " >Thuringia</option> \n </select> '
2007-04-04 11:40:08 +00:00
# DEIdentityCardNumberField #################################################
>> > from django . contrib . localflavor . de . forms import DEIdentityCardNumberField
>> > f = DEIdentityCardNumberField ( )
>> > f . clean ( ' 7549313035D-6004103-0903042-0 ' )
u ' 7549313035D-6004103-0903042-0 '
>> > f . clean ( ' 9786324830D 6104243 0910271 2 ' )
u ' 9786324830D-6104243-0910271-2 '
>> > f . clean ( ' 0434657485D-6407276-0508137-9 ' )
Traceback ( most recent call last ) :
. . .
2007-04-06 04:24:06 +00:00
ValidationError : [ u ' Enter a valid German identity card number in XXXXXXXXXXX-XXXXXXX-XXXXXXX-X format. ' ]
2007-04-08 13:22:48 +00:00
2007-05-01 03:10:10 +00:00
# CHZipCodeField ############################################################
>> > from django . contrib . localflavor . ch . forms import CHZipCodeField
>> > f = CHZipCodeField ( )
>> > f . clean ( ' 800x ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a zip code in the format XXXX. ' ]
>> > f . clean ( ' 80 00 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a zip code in the format XXXX. ' ]
>> > f . clean ( ' 8000 ' )
u ' 8000 '
# CHPhoneNumberField ########################################################
>> > from django . contrib . localflavor . ch . forms import CHPhoneNumberField
>> > f = CHPhoneNumberField ( )
>> > f . clean ( ' 01234567890 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Phone numbers must be in 0XX XXX XX XX format. ' ]
>> > f . clean ( ' 1234567890 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Phone numbers must be in 0XX XXX XX XX format. ' ]
>> > f . clean ( ' 0123456789 ' )
u ' 012 345 67 89 '
# CHIdentityCardNumberField #################################################
>> > from django . contrib . localflavor . ch . forms import CHIdentityCardNumberField
>> > f = CHIdentityCardNumberField ( )
>> > f . clean ( ' C1234567<0 ' )
u ' C1234567<0 '
>> > f . clean ( ' C1234567<1 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a valid Swiss identity or passport card number in X1234567<0 or 1234567890 format. ' ]
>> > f . clean ( ' 2123456700 ' )
u ' 2123456700 '
>> > f . clean ( ' 2123456701 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a valid Swiss identity or passport card number in X1234567<0 or 1234567890 format. ' ]
# CHStateSelect #############################################################
>> > from django . contrib . localflavor . ch . forms import CHStateSelect
>> > w = CHStateSelect ( )
>> > w . render ( ' state ' , ' AG ' )
u ' <select name= " state " > \n <option value= " AG " selected= " selected " >Aargau</option> \n <option value= " AI " >Appenzell Innerrhoden</option> \n <option value= " AR " >Appenzell Ausserrhoden</option> \n <option value= " BS " >Basel-Stadt</option> \n <option value= " BL " >Basel-Land</option> \n <option value= " BE " >Berne</option> \n <option value= " FR " >Fribourg</option> \n <option value= " GE " >Geneva</option> \n <option value= " GL " >Glarus</option> \n <option value= " GR " >Graubuenden</option> \n <option value= " JU " >Jura</option> \n <option value= " LU " >Lucerne</option> \n <option value= " NE " >Neuchatel</option> \n <option value= " NW " >Nidwalden</option> \n <option value= " OW " >Obwalden</option> \n <option value= " SH " >Schaffhausen</option> \n <option value= " SZ " >Schwyz</option> \n <option value= " SO " >Solothurn</option> \n <option value= " SG " >St. Gallen</option> \n <option value= " TG " >Thurgau</option> \n <option value= " TI " >Ticino</option> \n <option value= " UR " >Uri</option> \n <option value= " VS " >Valais</option> \n <option value= " VD " >Vaud</option> \n <option value= " ZG " >Zug</option> \n <option value= " ZH " >Zurich</option> \n </select> '
2007-04-08 13:22:48 +00:00
## AUPostCodeField ##########################################################
A field that accepts a four digit Australian post code .
>> > from django . contrib . localflavor . au . forms import AUPostCodeField
>> > f = AUPostCodeField ( )
>> > f . clean ( ' 1234 ' )
u ' 1234 '
>> > f . clean ( ' 2000 ' )
u ' 2000 '
>> > f . clean ( ' abcd ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a 4 digit post code. ' ]
>> > f . clean ( ' 20001 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a 4 digit post code. ' ]
>> > f . clean ( None )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field is required. ' ]
>> > f . clean ( ' ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field is required. ' ]
>> > f = AUPostCodeField ( required = False )
>> > f . clean ( ' 1234 ' )
u ' 1234 '
>> > f . clean ( ' 2000 ' )
u ' 2000 '
>> > f . clean ( ' abcd ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a 4 digit post code. ' ]
>> > f . clean ( ' 20001 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a 4 digit post code. ' ]
>> > f . clean ( None )
u ' '
>> > f . clean ( ' ' )
u ' '
## AUPhoneNumberField ########################################################
A field that accepts a 10 digit Australian phone number .
llows spaces and parentheses around area code .
>> > from django . contrib . localflavor . au . forms import AUPhoneNumberField
>> > f = AUPhoneNumberField ( )
>> > f . clean ( ' 1234567890 ' )
u ' 1234567890 '
>> > f . clean ( ' 0213456789 ' )
u ' 0213456789 '
>> > f . clean ( ' 02 13 45 67 89 ' )
u ' 0213456789 '
>> > f . clean ( ' (02) 1345 6789 ' )
u ' 0213456789 '
>> > f . clean ( ' (02) 1345-6789 ' )
u ' 0213456789 '
>> > f . clean ( ' (02)1345-6789 ' )
u ' 0213456789 '
>> > f . clean ( ' 0408 123 456 ' )
u ' 0408123456 '
>> > f . clean ( ' 123 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Phone numbers must contain 10 digits. ' ]
>> > f . clean ( ' 1800DJANGO ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Phone numbers must contain 10 digits. ' ]
>> > f . clean ( None )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field is required. ' ]
>> > f . clean ( ' ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field is required. ' ]
>> > f = AUPhoneNumberField ( required = False )
>> > f . clean ( ' 1234567890 ' )
u ' 1234567890 '
>> > f . clean ( ' 0213456789 ' )
u ' 0213456789 '
>> > f . clean ( ' 02 13 45 67 89 ' )
u ' 0213456789 '
>> > f . clean ( ' (02) 1345 6789 ' )
u ' 0213456789 '
>> > f . clean ( ' (02) 1345-6789 ' )
u ' 0213456789 '
>> > f . clean ( ' (02)1345-6789 ' )
u ' 0213456789 '
>> > f . clean ( ' 0408 123 456 ' )
u ' 0408123456 '
>> > f . clean ( ' 123 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Phone numbers must contain 10 digits. ' ]
>> > f . clean ( ' 1800DJANGO ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Phone numbers must contain 10 digits. ' ]
>> > f . clean ( None )
u ' '
>> > f . clean ( ' ' )
u ' '
## AUStateSelect #############################################################
AUStateSelect is a Select widget that uses a list of Australian
states / territories as its choices .
>> > from django . contrib . localflavor . au . forms import AUStateSelect
>> > f = AUStateSelect ( )
>> > print f . render ( ' state ' , ' NSW ' )
< select name = " state " >
< option value = " ACT " > Australian Capital Territory < / option >
< option value = " NSW " selected = " selected " > New South Wales < / option >
< option value = " NT " > Northern Territory < / option >
< option value = " QLD " > Queensland < / option >
< option value = " SA " > South Australia < / option >
< option value = " TAS " > Tasmania < / option >
< option value = " VIC " > Victoria < / option >
< option value = " WA " > Western Australia < / option >
< / select >
2007-04-26 08:43:25 +00:00
## ISIdNumberField #############################################################
>> > from django . contrib . localflavor . is_ . forms import *
>> > f = ISIdNumberField ( )
>> > f . clean ( ' 2308803449 ' )
u ' 230880-3449 '
>> > f . clean ( ' 230880-3449 ' )
u ' 230880-3449 '
>> > f . clean ( ' 230880 3449 ' )
u ' 230880-3449 '
>> > f . clean ( ' 230880343 ' )
Traceback ( most recent call last ) :
. . .
2007-07-13 14:13:35 +00:00
ValidationError : [ u ' Ensure this value has at least 10 characters (it has 9). ' ]
2007-04-26 08:43:25 +00:00
>> > f . clean ( ' 230880343234 ' )
Traceback ( most recent call last ) :
. . .
2007-07-13 14:13:35 +00:00
ValidationError : [ u ' Ensure this value has at most 11 characters (it has 12). ' ]
2007-04-26 08:43:25 +00:00
>> > f . clean ( ' abcdefghijk ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a valid Icelandic identification number. The format is XXXXXX-XXXX. ' ]
>> > f . clean ( ' ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field is required. ' ]
>> > f . clean ( None )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field is required. ' ]
>> > f . clean ( ' 2308803439 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' The Icelandic identification number is not valid. ' ]
>> > f . clean ( ' 2308803440 ' )
u ' 230880-3440 '
>> > f = ISIdNumberField ( required = False )
>> > f . clean ( None )
u ' '
>> > f . clean ( ' ' )
u ' '
## ISPhoneNumberField #############################################################
>> > from django . contrib . localflavor . is_ . forms import *
>> > f = ISPhoneNumberField ( )
>> > f . clean ( ' 1234567 ' )
u ' 1234567 '
>> > f . clean ( ' 123 4567 ' )
u ' 1234567 '
>> > f . clean ( ' 123-4567 ' )
u ' 1234567 '
>> > f . clean ( ' 123-456 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a valid value. ' ]
>> > f . clean ( ' 123456 ' )
Traceback ( most recent call last ) :
. . .
2007-07-13 14:13:35 +00:00
ValidationError : [ u ' Ensure this value has at least 7 characters (it has 6). ' ]
2007-04-26 08:43:25 +00:00
>> > f . clean ( ' 123456555 ' )
Traceback ( most recent call last ) :
. . .
2007-07-13 14:13:35 +00:00
ValidationError : [ u ' Ensure this value has at most 8 characters (it has 9). ' ]
2007-04-26 08:43:25 +00:00
>> > f . clean ( ' abcdefg ' )
Traceback ( most recent call last ) :
ValidationError : [ u ' Enter a valid value. ' ]
>> > f . clean ( ' 1234567 ' )
Traceback ( most recent call last ) :
. . .
2007-07-13 14:13:35 +00:00
ValidationError : [ u ' Ensure this value has at most 8 characters (it has 9). ' ]
2007-04-26 08:43:25 +00:00
>> > f . clean ( ' 12367 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a valid value. ' ]
>> > f . clean ( ' ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field is required. ' ]
>> > f . clean ( None )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field is required. ' ]
>> > f = ISPhoneNumberField ( required = False )
>> > f . clean ( None )
u ' '
>> > f . clean ( ' ' )
u ' '
## ISPostalCodeSelect #############################################################
>> > from django . contrib . localflavor . is_ . forms import *
>> > f = ISPostalCodeSelect ( )
>> > f . render ( ' foo ' , ' bar ' )
u ' <select name= " foo " > \n <option value= " 101 " >101 Reykjav \xed k</option> \n <option value= " 103 " >103 Reykjav \xed k</option> \n <option value= " 104 " >104 Reykjav \xed k</option> \n <option value= " 105 " >105 Reykjav \xed k</option> \n <option value= " 107 " >107 Reykjav \xed k</option> \n <option value= " 108 " >108 Reykjav \xed k</option> \n <option value= " 109 " >109 Reykjav \xed k</option> \n <option value= " 110 " >110 Reykjav \xed k</option> \n <option value= " 111 " >111 Reykjav \xed k</option> \n <option value= " 112 " >112 Reykjav \xed k</option> \n <option value= " 113 " >113 Reykjav \xed k</option> \n <option value= " 116 " >116 Kjalarnes</option> \n <option value= " 121 " >121 Reykjav \xed k</option> \n <option value= " 123 " >123 Reykjav \xed k</option> \n <option value= " 124 " >124 Reykjav \xed k</option> \n <option value= " 125 " >125 Reykjav \xed k</option> \n <option value= " 127 " >127 Reykjav \xed k</option> \n <option value= " 128 " >128 Reykjav \xed k</option> \n <option value= " 129 " >129 Reykjav \xed k</option> \n <option value= " 130 " >130 Reykjav \xed k</option> \n <option value= " 132 " >132 Reykjav \xed k</option> \n <option value= " 150 " >150 Reykjav \xed k</option> \n <option value= " 155 " >155 Reykjav \xed k</option> \n <option value= " 170 " >170 Seltjarnarnes</option> \n <option value= " 172 " >172 Seltjarnarnes</option> \n <option value= " 190 " >190 Vogar</option> \n <option value= " 200 " >200 K \xf3 pavogur</option> \n <option value= " 201 " >201 K \xf3 pavogur</option> \n <option value= " 202 " >202 K \xf3 pavogur</option> \n <option value= " 203 " >203 K \xf3 pavogur</option> \n <option value= " 210 " >210 Gar \xf0 ab \xe6 r</option> \n <option value= " 212 " >212 Gar \xf0 ab \xe6 r</option> \n <option value= " 220 " >220 Hafnarfj \xf6 r \xf0 ur</option> \n <option value= " 221 " >221 Hafnarfj \xf6 r \xf0 ur</option> \n <option value= " 222 " >222 Hafnarfj \xf6 r \xf0 ur</option> \n <option value= " 225 " >225 \xc1 lftanes</option> \n <option value= " 230 " >230 Reykjanesb \xe6 r</option> \n <option value= " 232 " >232 Reykjanesb \xe6 r</option> \n <option value= " 233 " >233 Reykjanesb \xe6 r</option> \n <option value= " 235 " >235 Keflav \xed kurflugv \xf6 llur</option> \n <option value= " 240 " >240 Grindav \xed k</option> \n <option value= " 245 " >245 Sandger \xf0 i</option> \n <option value= " 250 " >250 Gar \xf0 ur</option> \n <option value= " 260 " >260 Reykjanesb \xe6 r</option> \n <option value= " 270 " >270 Mosfellsb \xe6 r</option> \n <option value= " 300 " >300 Akranes</option> \n <option value= " 301 " >301 Akranes</option> \n <option value= " 302 " >302 Akranes</option> \n <option value= " 310 " >310 Borgarnes</option> \n <option value= " 311 " >311 Borgarnes</option> \n <option value= " 320 " >320 Reykholt \xed Borgarfir \xf0 i</option> \n <option value= " 340 " >340 Stykkish \xf3 lmur</option> \n <option value= " 345 " >345 Flatey \xe1 Brei \xf0 afir \xf0 i</option> \n <option value= " 350 " >350 Grundarfj \xf6 r \xf0 ur</option> \n <option value= " 355 " >355 \xd3 lafsv \xed k</option> \n <option value= " 356 " >356 Sn \xe6 fellsb \xe6 r</option> \n <option value= " 360 " >360 Hellissandur</option> \n <option value= " 370 " >370 B \xfa \xf0 ardalur</option> \n <option value= " 371 " >371 B \xfa \xf0 ardalur</option> \n <option value= " 380 " >380 Reykh \xf3 lahreppur</option> \n <option value= " 400 " >400 \xcd safj \xf6 r \xf0 ur</option> \n <option value= " 401 " >401 \xcd safj \xf6 r \xf0 ur</option> \n <option value= " 410 " >410 Hn \xed fsdalur</option> \n <option value= " 415 " >415 Bolungarv \xed k</option> \n <option value= " 420 " >420 S \xfa \xf0 av \xed k</option> \n <option value= " 425 " >425 Flateyri</option> \n <option value= " 430 " >430 Su \xf0 ureyri</option> \n <option value= " 450 " >450 Patreksfj \xf6 r \xf0 ur</option> \n <option value= " 451 " >451 Patreksfj \xf6 r \xf0 ur</option> \n <option value= " 460 " >460 T \xe1 lknafj \xf6 r \xf0 ur</option> \n <option value= " 465 " >465 B \xed ldudalur</option> \n <option value= " 470 " >470 \xde ingeyri</option> \n <option value= " 471 " >471 \xde ingeyri</option> \n <option value= " 500 " >500 Sta \xf0 ur</option> \n <option value= " 510 " >510 H \xf3 lmav \xed k</option> \n <option value= " 512 " >512 H \xf3 lmav \xed k</option> \n <option value= " 520 " >520 Drangsnes</option> \n <option value= " 522 " >522 Kj \xf6 rvogur</option> \n <option value= " 523 " >523 B \xe6 r</option> \n <option value= " 524 " >524 Nor \xf0 urfj \xf6 r \xf0 ur</option> \n <option value= " 530 " >530 Hvammstangi</option> \n <option value= " 531 " >531 Hvammstangi</option> \n <option value= " 540 " >540 Bl \xf6 ndu \xf3 s</option> \n <option value= " 541 " >541 Bl \xf6 ndu \xf3 s</o
2007-04-26 12:41:34 +00:00
## CLRutField #############################################################
CLRutField is a Field that checks the validity of the Chilean
personal identification number ( RUT ) . It has two modes relaxed ( default ) and
strict .
>> > from django . contrib . localflavor . cl . forms import CLRutField
>> > rut = CLRutField ( )
>> > rut . clean ( ' 11-6 ' )
Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.
Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04 12:11:04 +00:00
u ' 11-6 '
2007-04-26 12:41:34 +00:00
>> > rut . clean ( ' 116 ' )
Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.
Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04 12:11:04 +00:00
u ' 11-6 '
2007-04-26 12:41:34 +00:00
# valid format, bad verifier.
>> > rut . clean ( ' 11.111.111-0 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' The Chilean RUT is not valid. ' ]
>> > rut . clean ( ' 111 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' The Chilean RUT is not valid. ' ]
>> > rut . clean ( ' 767484100 ' )
Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.
Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04 12:11:04 +00:00
u ' 76.748.410-0 '
2007-04-26 12:41:34 +00:00
>> > rut . clean ( ' 78.412.790-7 ' )
Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.
Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04 12:11:04 +00:00
u ' 78.412.790-7 '
2007-04-26 12:41:34 +00:00
>> > rut . clean ( ' 8.334.6043 ' )
Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.
Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04 12:11:04 +00:00
u ' 8.334.604-3 '
2007-04-26 12:41:34 +00:00
>> > rut . clean ( ' 76793310-K ' )
Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.
Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04 12:11:04 +00:00
u ' 76.793.310-K '
2007-04-26 12:41:34 +00:00
Strict RUT usage ( does not allow imposible values )
>> > rut = CLRutField ( strict = True )
>> > rut . clean ( ' 11-6 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter valid a Chilean RUT. The format is XX.XXX.XXX-X. ' ]
# valid format, bad verifier.
>> > rut . clean ( ' 11.111.111-0 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' The Chilean RUT is not valid. ' ]
# Correct input, invalid format.
>> > rut . clean ( ' 767484100 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter valid a Chilean RUT. The format is XX.XXX.XXX-X. ' ]
>> > rut . clean ( ' 78.412.790-7 ' )
Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.
Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04 12:11:04 +00:00
u ' 78.412.790-7 '
2007-04-26 12:41:34 +00:00
>> > rut . clean ( ' 8.334.6043 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter valid a Chilean RUT. The format is XX.XXX.XXX-X. ' ]
>> > rut . clean ( ' 76793310-K ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter valid a Chilean RUT. The format is XX.XXX.XXX-X. ' ]
2007-07-12 12:44:05 +00:00
## CLRegionSelect #########################################################
>> > from django . contrib . localflavor . cl . forms import CLRegionSelect
>> > f = CLRegionSelect ( )
>> > f . render ( ' foo ' , ' bar ' )
u ' <select name= " foo " > \n <option value= " RM " >Regi \xf3 n Metropolitana de Santiago</option> \n <option value= " I " >Regi \xf3 n de Tarapac \xe1 </option> \n <option value= " II " >Regi \xf3 n de Antofagasta</option> \n <option value= " III " >Regi \xf3 n de Atacama</option> \n <option value= " IV " >Regi \xf3 n de Coquimbo</option> \n <option value= " V " >Regi \xf3 n de Valpara \xed so</option> \n <option value= " VI " >Regi \xf3 n del Libertador Bernardo O'Higgins</option> \n <option value= " VII " >Regi \xf3 n del Maule</option> \n <option value= " VIII " >Regi \xf3 n del B \xed o B \xed o</option> \n <option value= " IX " >Regi \xf3 n de la Araucan \xed a</option> \n <option value= " X " >Regi \xf3 n de los Lagos</option> \n <option value= " XI " >Regi \xf3 n de Ays \xe9 n del General Carlos Ib \xe1 \xf1 ez del Campo</option> \n <option value= " XII " >Regi \xf3 n de Magallanes y la Ant \xe1 rtica Chilena</option> \n <option value= " XIV " >Regi \xf3 n de Los R \xed os</option> \n <option value= " XV " >Regi \xf3 n de Arica-Parinacota</option> \n </select> '
2007-07-19 09:24:36 +00:00
# SKPostalCodeField #########################################################
>> > from django . contrib . localflavor . sk . forms import SKPostalCodeField
>> > f = SKPostalCodeField ( )
>> > f . clean ( ' 84545x ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a postal code in the format XXXXX or XXX XX. ' ]
>> > f . clean ( ' 91909 ' )
u ' 91909 '
>> > f . clean ( ' 917 01 ' )
u ' 91701 '
# SKRegionSelect ############################################################
>> > from django . contrib . localflavor . sk . forms import SKRegionSelect
>> > w = SKRegionSelect ( )
>> > w . render ( ' regions ' , ' TT ' )
u ' <select name= " regions " > \n <option value= " BB " >Banska Bystrica region</option> \n <option value= " BA " >Bratislava region</option> \n <option value= " KE " >Kosice region</option> \n <option value= " NR " >Nitra region</option> \n <option value= " PO " >Presov region</option> \n <option value= " TN " >Trencin region</option> \n <option value= " TT " selected= " selected " >Trnava region</option> \n <option value= " ZA " >Zilina region</option> \n </select> '
# SKDistrictSelect ##########################################################
>> > from django . contrib . localflavor . sk . forms import SKDistrictSelect
>> > w = SKDistrictSelect ( )
>> > w . render ( ' Districts ' , ' RK ' )
u ' <select name= " Districts " > \n <option value= " BB " >Banska Bystrica</option> \n <option value= " BS " >Banska Stiavnica</option> \n <option value= " BJ " >Bardejov</option> \n <option value= " BN " >Banovce nad Bebravou</option> \n <option value= " BR " >Brezno</option> \n <option value= " BA1 " >Bratislava I</option> \n <option value= " BA2 " >Bratislava II</option> \n <option value= " BA3 " >Bratislava III</option> \n <option value= " BA4 " >Bratislava IV</option> \n <option value= " BA5 " >Bratislava V</option> \n <option value= " BY " >Bytca</option> \n <option value= " CA " >Cadca</option> \n <option value= " DT " >Detva</option> \n <option value= " DK " >Dolny Kubin</option> \n <option value= " DS " >Dunajska Streda</option> \n <option value= " GA " >Galanta</option> \n <option value= " GL " >Gelnica</option> \n <option value= " HC " >Hlohovec</option> \n <option value= " HE " >Humenne</option> \n <option value= " IL " >Ilava</option> \n <option value= " KK " >Kezmarok</option> \n <option value= " KN " >Komarno</option> \n <option value= " KE1 " >Kosice I</option> \n <option value= " KE2 " >Kosice II</option> \n <option value= " KE3 " >Kosice III</option> \n <option value= " KE4 " >Kosice IV</option> \n <option value= " KEO " >Kosice - okolie</option> \n <option value= " KA " >Krupina</option> \n <option value= " KM " >Kysucke Nove Mesto</option> \n <option value= " LV " >Levice</option> \n <option value= " LE " >Levoca</option> \n <option value= " LM " >Liptovsky Mikulas</option> \n <option value= " LC " >Lucenec</option> \n <option value= " MA " >Malacky</option> \n <option value= " MT " >Martin</option> \n <option value= " ML " >Medzilaborce</option> \n <option value= " MI " >Michalovce</option> \n <option value= " MY " >Myjava</option> \n <option value= " NO " >Namestovo</option> \n <option value= " NR " >Nitra</option> \n <option value= " NM " >Nove Mesto nad Vahom</option> \n <option value= " NZ " >Nove Zamky</option> \n <option value= " PE " >Partizanske</option> \n <option value= " PK " >Pezinok</option> \n <option value= " PN " >Piestany</option> \n <option value= " PT " >Poltar</option> \n <option value= " PP " >Poprad</option> \n <option value= " PB " >Povazska Bystrica</option> \n <option value= " PO " >Presov</option> \n <option value= " PD " >Prievidza</option> \n <option value= " PU " >Puchov</option> \n <option value= " RA " >Revuca</option> \n <option value= " RS " >Rimavska Sobota</option> \n <option value= " RV " >Roznava</option> \n <option value= " RK " selected= " selected " >Ruzomberok</option> \n <option value= " SB " >Sabinov</option> \n <option value= " SC " >Senec</option> \n <option value= " SE " >Senica</option> \n <option value= " SI " >Skalica</option> \n <option value= " SV " >Snina</option> \n <option value= " SO " >Sobrance</option> \n <option value= " SN " >Spisska Nova Ves</option> \n <option value= " SL " >Stara Lubovna</option> \n <option value= " SP " >Stropkov</option> \n <option value= " SK " >Svidnik</option> \n <option value= " SA " >Sala</option> \n <option value= " TO " >Topolcany</option> \n <option value= " TV " >Trebisov</option> \n <option value= " TN " >Trencin</option> \n <option value= " TT " >Trnava</option> \n <option value= " TR " >Turcianske Teplice</option> \n <option value= " TS " >Tvrdosin</option> \n <option value= " VK " >Velky Krtis</option> \n <option value= " VT " >Vranov nad Toplou</option> \n <option value= " ZM " >Zlate Moravce</option> \n <option value= " ZV " >Zvolen</option> \n <option value= " ZC " >Zarnovica</option> \n <option value= " ZH " >Ziar nad Hronom</option> \n <option value= " ZA " >Zilina</option> \n </select> '
2007-08-19 07:38:39 +00:00
# PLVoivodeshipSelect ##########################################################
>> > from django . contrib . localflavor . pl . forms import PLVoivodeshipSelect
>> > f = PLVoivodeshipSelect ( )
>> > f . render ( ' voivodeships ' , ' pomerania ' )
u ' <select name= " voivodeships " > \n <option value= " lower_silesia " >Lower Silesia</option> \n <option value= " kuyavia-pomerania " >Kuyavia-Pomerania</option> \n <option value= " lublin " >Lublin</option> \n <option value= " lubusz " >Lubusz</option> \n <option value= " lodz " >Lodz</option> \n <option value= " lesser_poland " >Lesser Poland</option> \n <option value= " masovia " >Masovia</option> \n <option value= " opole " >Opole</option> \n <option value= " subcarpatia " >Subcarpatia</option> \n <option value= " podlasie " >Podlasie</option> \n <option value= " pomerania " selected= " selected " >Pomerania</option> \n <option value= " silesia " >Silesia</option> \n <option value= " swietokrzyskie " >Swietokrzyskie</option> \n <option value= " warmia-masuria " >Warmia-Masuria</option> \n <option value= " greater_poland " >Greater Poland</option> \n <option value= " west_pomerania " >West Pomerania</option> \n </select> '
# PLAdministrativeUnitSelect ##########################################################
>> > from django . contrib . localflavor . pl . forms import PLAdministrativeUnitSelect
>> > f = PLAdministrativeUnitSelect ( )
>> > f . render ( ' administrativeunit ' , ' katowice ' )
u ' <select name= " administrativeunit " > \n <option value= " wroclaw " >Wroc \u0142 aw</option> \n <option value= " jeleniagora " >Jelenia G \xf3 ra</option> \n <option value= " legnica " >Legnica</option> \n <option value= " boleslawiecki " >boles \u0142 awiecki</option> \n <option value= " dzierzoniowski " >dzier \u017c oniowski</option> \n <option value= " glogowski " >g \u0142 ogowski</option> \n <option value= " gorowski " >g \xf3 rowski</option> \n <option value= " jaworski " >jaworski</option> \n <option value= " jeleniogorski " >jeleniog \xf3 rski</option> \n <option value= " kamiennogorski " >kamiennog \xf3 rski</option> \n <option value= " klodzki " >k \u0142 odzki</option> \n <option value= " legnicki " >legnicki</option> \n <option value= " lubanski " >luba \u0144 ski</option> \n <option value= " lubinski " >lubi \u0144 ski</option> \n <option value= " lwowecki " >lw \xf3 wecki</option> \n <option value= " milicki " >milicki</option> \n <option value= " olesnicki " >ole \u015b nicki</option> \n <option value= " olawski " >o \u0142 awski</option> \n <option value= " polkowicki " >polkowicki</option> \n <option value= " strzelinski " >strzeli \u0144 ski</option> \n <option value= " sredzki " > \u015b redzki</option> \n <option value= " swidnicki " > \u015b widnicki</option> \n <option value= " trzebnicki " >trzebnicki</option> \n <option value= " walbrzyski " >wa \u0142 brzyski</option> \n <option value= " wolowski " >wo \u0142 owski</option> \n <option value= " wroclawski " >wroc \u0142 awski</option> \n <option value= " zabkowicki " >z \u0105 bkowicki</option> \n <option value= " zgorzelecki " >zgorzelecki</option> \n <option value= " zlotoryjski " >z \u0142 otoryjski</option> \n <option value= " bydgoszcz " >Bydgoszcz</option> \n <option value= " torun " >Toru \u0144 </option> \n <option value= " wloclawek " >W \u0142 oc \u0142 awek</option> \n <option value= " grudziadz " >Grudzi \u0105 dz</option> \n <option value= " aleksandrowski " >aleksandrowski</option> \n <option value= " brodnicki " >brodnicki</option> \n <option value= " bydgoski " >bydgoski</option> \n <option value= " chelminski " >che \u0142 mi \u0144 ski</option> \n <option value= " golubsko-dobrzynski " >golubsko-dobrzy \u0144 ski</option> \n <option value= " grudziadzki " >grudzi \u0105 dzki</option> \n <option value= " inowroclawski " >inowroc \u0142 awski</option> \n <option value= " lipnowski " >lipnowski</option> \n <option value= " mogilenski " >mogile \u0144 ski</option> \n <option value= " nakielski " >nakielski</option> \n <option value= " radziejowski " >radziejowski</option> \n <option value= " rypinski " >rypi \u0144 ski</option> \n <option value= " sepolenski " >s \u0119 pole \u0144 ski</option> \n <option value= " swiecki " > \u015b wiecki</option> \n <option value= " torunski " >toru \u0144 ski</option> \n <option value= " tucholski " >tucholski</option> \n <option value= " wabrzeski " >w \u0105 brzeski</option> \n <option value= " wloclawski " >wroc \u0142 awski</option> \n <option value= " zninski " > \u017a ni \u0144 ski</option> \n <option value= " lublin " >Lublin</option> \n <option value= " biala-podlaska " >Bia \u0142 a Podlaska</option> \n <option value= " chelm " >Che \u0142 m</option> \n <option value= " zamosc " >Zamo \u015b \u0107 </option> \n <option value= " bialski " >bialski</option> \n <option value= " bilgorajski " >bi \u0142 gorajski</option> \n <option value= " chelmski " >che \u0142 mski</option> \n <option value= " hrubieszowski " >hrubieszowski</option> \n <option value= " janowski " >janowski</option> \n <option value= " krasnostawski " >krasnostawski</option> \n <option value= " krasnicki " >kra \u015b nicki</option> \n <option value= " lubartowski " >lubartowski</option> \n <option value= " lubelski " >lubelski</option> \n <option value= " leczynski " > \u0142 \u0119 czy \u0144 ski</option> \n <option value= " lukowski " > \u0142 ukowski</option> \n <option value= " opolski " >opolski</option> \n <option value= " parczewski " >parczewski</option> \n <option value= " pulawski " >pu \u0142 awski</option> \n <option value= " radzynski " >radzy \u0144 ski</option> \n <option value= " rycki " >rycki</option> \n <option value= " swidnicki " > \u015b widnicki</option> \n <option value= " tomaszowski " >tomaszowski</option> \n <option value= " wlodawski " >w \u0142 odawski</option> \n <option value= " zamojski " >zamojski</option> \n <option value= " gorzow-wielkopolski " >Gorz \xf3 w Wielkopolski</option> \n <option value= " zielona-gora " >Zielona G \xf3 ra</option> \n <option value= " gorzowski " >gorzowski</option> \n <option value= " krosnienski " >kro \u015b nie \u0144 ski</option> \n <option va
# PLPostalCodeField ##############################################################
>> > from django . contrib . localflavor . pl . forms import PLPostalCodeField
>> > f = PLPostalCodeField ( )
>> > f . clean ( ' 43--434 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a postal code in the format XX-XXX. ' ]
>> > f . clean ( ' 41-403 ' )
u ' 41-403 '
# PLTaxNumberField ###############################################################
>> > from django . contrib . localflavor . pl . forms import PLTaxNumberField
>> > f = PLTaxNumberField ( )
>> > f . clean ( ' 43-343-234-323 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a tax number field (NIP) in the format XXX-XXX-XX-XX or XX-XX-XXX-XXX. ' ]
>> > f . clean ( ' 43-34-234-323 ' )
u ' 43-34-234-323 '
>> > f . clean ( ' 433-344-24-23 ' )
u ' 433-344-24-23 '
# PLNationalIdentificationNumberField ############################################
2007-07-12 12:44:05 +00:00
2007-08-19 07:38:39 +00:00
>> > from django . contrib . localflavor . pl . forms import PLNationalIdentificationNumberField
>> > f = PLNationalIdentificationNumberField ( )
>> > f . clean ( ' 80071610614 ' )
u ' 80071610614 '
>> > f . clean ( ' 80071610610 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Wrong checksum for the National Identification Number. ' ]
>> > f . clean ( ' 80 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' National Identification Number consists of 11 digits. ' ]
>> > f . clean ( ' 800716106AA ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' National Identification Number consists of 11 digits. ' ]
2007-09-13 22:16:59 +00:00
# NLPhoneNumberField ########################################################
>> > from django . contrib . localflavor . nl . forms import NLPhoneNumberField
>> > f = NLPhoneNumberField ( required = False )
>> > f . clean ( ' ' )
u ' '
>> > f . clean ( ' 012-3456789 ' )
' 012-3456789 '
>> > f . clean ( ' 0123456789 ' )
' 0123456789 '
>> > f . clean ( ' +31-12-3456789 ' )
' +31-12-3456789 '
>> > f . clean ( ' (0123) 456789 ' )
' (0123) 456789 '
>> > f . clean ( ' foo ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a valid phone number ' ]
# NLZipCodeField ############################################################
>> > from django . contrib . localflavor . nl . forms import NLZipCodeField
>> > f = NLZipCodeField ( required = False )
>> > f . clean ( ' ' )
u ' '
>> > f . clean ( ' 1234ab ' )
u ' 1234 AB '
>> > f . clean ( ' 1234 ab ' )
u ' 1234 AB '
>> > f . clean ( ' 1234 AB ' )
u ' 1234 AB '
>> > f . clean ( ' 0123AB ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a valid postal code ' ]
>> > f . clean ( ' foo ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a valid postal code ' ]
# NLSoFiNumberField #########################################################
>> > from django . contrib . localflavor . nl . forms import NLSoFiNumberField
>> > f = NLSoFiNumberField ( required = False )
>> > f . clean ( ' ' )
u ' '
>> > f . clean ( ' 123456782 ' )
' 123456782 '
>> > f . clean ( ' 000000000 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a valid SoFi number ' ]
>> > f . clean ( ' 123456789 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a valid SoFi number ' ]
>> > f . clean ( ' foo ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a valid SoFi number ' ]
# NLProvinceSelect ##########################################################
>> > from django . contrib . localflavor . nl . forms import NLProvinceSelect
>> > s = NLProvinceSelect ( )
>> > s . render ( ' provinces ' , ' OV ' )
u ' <select name= " provinces " > \n <option value= " DR " >Drente</option> \n <option value= " FL " >Flevoland</option> \n <option value= " FR " >Friesland</option> \n <option value= " GL " >Gelderland</option> \n <option value= " GR " >Groningen</option> \n <option value= " LB " >Limburg</option> \n <option value= " NB " >Noord-Brabant</option> \n <option value= " NH " >Noord-Holland</option> \n <option value= " OV " selected= " selected " >Overijssel</option> \n <option value= " UT " >Utrecht</option> \n <option value= " ZE " >Zeeland</option> \n <option value= " ZH " >Zuid-Holland</option> \n </select> '
2007-09-14 00:58:57 +00:00
# ARProvinceField #############################################################
>> > from django . contrib . localflavor . ar . forms import ARProvinceSelect
>> > f = ARProvinceSelect ( )
>> > f . render ( ' provincias ' , ' A ' )
u ' <select name= " provincias " > \n <option value= " B " >Buenos Aires</option> \n <option value= " K " >Catamarca</option> \n <option value= " H " >Chaco</option> \n <option value= " U " >Chubut</option> \n <option value= " C " >Ciudad Aut \xf3 noma de Buenos Aires</option> \n <option value= " X " >C \xf3 rdoba</option> \n <option value= " W " >Corrientes</option> \n <option value= " E " >Entre R \xed os</option> \n <option value= " P " >Formosa</option> \n <option value= " Y " >Jujuy</option> \n <option value= " L " >La Pampa</option> \n <option value= " F " >La Rioja</option> \n <option value= " M " >Mendoza</option> \n <option value= " N " >Misiones</option> \n <option value= " Q " >Neuqu \xe9 n</option> \n <option value= " R " >R \xed o Negro</option> \n <option value= " A " selected= " selected " >Salta</option> \n <option value= " J " >San Juan</option> \n <option value= " D " >San Luis</option> \n <option value= " Z " >Santa Cruz</option> \n <option value= " S " >Santa Fe</option> \n <option value= " G " >Santiago del Estero</option> \n <option value= " V " >Tierra del Fuego, Ant \xe1 rtida e Islas del Atl \xe1 ntico Sur</option> \n <option value= " T " >Tucum \xe1 n</option> \n </select> '
# ARPostalCodeField ###########################################################
>> > from django . contrib . localflavor . ar . forms import ARPostalCodeField
>> > f = ARPostalCodeField ( )
>> > f . clean ( ' 5000 ' )
u ' 5000 '
>> > f . clean ( ' C1064AAB ' )
u ' C1064AAB '
>> > f . clean ( ' c1064AAB ' )
u ' C1064AAB '
>> > f . clean ( ' C1064aab ' )
u ' C1064AAB '
>> > f . clean ( u ' 4400 ' )
u ' 4400 '
>> > f . clean ( u ' C1064AAB ' )
u ' C1064AAB '
>> > f . clean ( ' C1064AABB ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Ensure this value has at most 8 characters (it has 9). ' ]
>> > f . clean ( ' C1064AA ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a postal code in the format NNNN or ANNNNAAA. ' ]
>> > f . clean ( ' C106AAB ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a postal code in the format NNNN or ANNNNAAA. ' ]
>> > f . clean ( ' 106AAB ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a postal code in the format NNNN or ANNNNAAA. ' ]
>> > f . clean ( ' 500 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Ensure this value has at least 4 characters (it has 3). ' ]
>> > f . clean ( ' 5PPP ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a postal code in the format NNNN or ANNNNAAA. ' ]
>> > f . clean ( None )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field is required. ' ]
>> > f . clean ( ' ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field is required. ' ]
>> > f . clean ( u ' ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field is required. ' ]
>> > f = ARPostalCodeField ( required = False )
>> > f . clean ( ' 5000 ' )
u ' 5000 '
>> > f . clean ( ' C1064AAB ' )
u ' C1064AAB '
>> > f . clean ( ' c1064AAB ' )
u ' C1064AAB '
>> > f . clean ( ' C1064aab ' )
u ' C1064AAB '
>> > f . clean ( u ' 4400 ' )
u ' 4400 '
>> > f . clean ( u ' C1064AAB ' )
u ' C1064AAB '
>> > f . clean ( ' C1064AABB ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Ensure this value has at most 8 characters (it has 9). ' ]
>> > f . clean ( ' C1064AA ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a postal code in the format NNNN or ANNNNAAA. ' ]
>> > f . clean ( ' C106AAB ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a postal code in the format NNNN or ANNNNAAA. ' ]
>> > f . clean ( ' 106AAB ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a postal code in the format NNNN or ANNNNAAA. ' ]
>> > f . clean ( ' 500 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Ensure this value has at least 4 characters (it has 3). ' ]
>> > f . clean ( ' 5PPP ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a postal code in the format NNNN or ANNNNAAA. ' ]
>> > f . clean ( None )
u ' '
>> > f . clean ( ' ' )
u ' '
>> > f . clean ( u ' ' )
u ' '
# ARDNIField ##################################################################
>> > from django . contrib . localflavor . ar . forms import ARDNIField
>> > f = ARDNIField ( )
>> > f . clean ( ' 20123456 ' )
u ' 20123456 '
>> > f . clean ( ' 20.123.456 ' )
u ' 20123456 '
>> > f . clean ( ' 9123456 ' )
u ' 9123456 '
>> > f . clean ( ' 9.123.456 ' )
u ' 9123456 '
>> > f . clean ( u ' 20123456 ' )
u ' 20123456 '
>> > f . clean ( u ' 20.123.456 ' )
u ' 20123456 '
>> > f . clean ( ' 20.123456 ' )
u ' 20123456 '
>> > f . clean ( ' 101234566 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field requires 7 or 8 digits. ' ]
>> > f . clean ( ' W0123456 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field requires only numbers. ' ]
>> > f . clean ( ' 10,123,456 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field requires only numbers. ' ]
>> > f . clean ( None )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field is required. ' ]
>> > f . clean ( ' ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field is required. ' ]
>> > f . clean ( u ' ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field is required. ' ]
>> > f = ARDNIField ( required = False )
>> > f . clean ( ' 20123456 ' )
u ' 20123456 '
>> > f . clean ( ' 20.123.456 ' )
u ' 20123456 '
>> > f . clean ( ' 9123456 ' )
u ' 9123456 '
>> > f . clean ( ' 9.123.456 ' )
u ' 9123456 '
>> > f . clean ( u ' 20123456 ' )
u ' 20123456 '
>> > f . clean ( u ' 20.123.456 ' )
u ' 20123456 '
>> > f . clean ( ' 20.123456 ' )
u ' 20123456 '
>> > f . clean ( ' 101234566 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field requires 7 or 8 digits. ' ]
>> > f . clean ( ' W0123456 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field requires only numbers. ' ]
>> > f . clean ( ' 10,123,456 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field requires only numbers. ' ]
>> > f . clean ( None )
u ' '
>> > f . clean ( ' ' )
u ' '
>> > f . clean ( u ' ' )
u ' '
# ARCUITField #################################################################
>> > from django . contrib . localflavor . ar . forms import ARCUITField
>> > f = ARCUITField ( )
>> > f . clean ( ' 20-10123456-9 ' )
u ' 20-10123456-9 '
>> > f . clean ( u ' 20-10123456-9 ' )
u ' 20-10123456-9 '
>> > f . clean ( ' 27-10345678-4 ' )
u ' 27-10345678-4 '
>> > f . clean ( ' 20101234569 ' )
u ' 20-10123456-9 '
>> > f . clean ( ' 27103456784 ' )
u ' 27-10345678-4 '
>> > f . clean ( ' 2-10123456-9 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a valid CUIT in XX-XXXXXXXX-X or XXXXXXXXXXXX format. ' ]
>> > f . clean ( ' 210123456-9 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a valid CUIT in XX-XXXXXXXX-X or XXXXXXXXXXXX format. ' ]
>> > f . clean ( ' 20-10123456 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a valid CUIT in XX-XXXXXXXX-X or XXXXXXXXXXXX format. ' ]
>> > f . clean ( ' 20-10123456- ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a valid CUIT in XX-XXXXXXXX-X or XXXXXXXXXXXX format. ' ]
>> > f . clean ( ' 20-10123456-5 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Invalid CUIT. ' ]
>> > f . clean ( u ' 2-10123456-9 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a valid CUIT in XX-XXXXXXXX-X or XXXXXXXXXXXX format. ' ]
>> > f . clean ( ' 27-10345678-1 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Invalid CUIT. ' ]
>> > f . clean ( u ' 27-10345678-1 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Invalid CUIT. ' ]
>> > f . clean ( None )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field is required. ' ]
>> > f . clean ( ' ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field is required. ' ]
>> > f . clean ( u ' ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' This field is required. ' ]
>> > f = ARCUITField ( required = False )
>> > f . clean ( ' 20-10123456-9 ' )
u ' 20-10123456-9 '
>> > f . clean ( u ' 20-10123456-9 ' )
u ' 20-10123456-9 '
>> > f . clean ( ' 27-10345678-4 ' )
u ' 27-10345678-4 '
>> > f . clean ( ' 20101234569 ' )
u ' 20-10123456-9 '
>> > f . clean ( ' 27103456784 ' )
u ' 27-10345678-4 '
>> > f . clean ( ' 2-10123456-9 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a valid CUIT in XX-XXXXXXXX-X or XXXXXXXXXXXX format. ' ]
>> > f . clean ( ' 210123456-9 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a valid CUIT in XX-XXXXXXXX-X or XXXXXXXXXXXX format. ' ]
>> > f . clean ( ' 20-10123456 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a valid CUIT in XX-XXXXXXXX-X or XXXXXXXXXXXX format. ' ]
>> > f . clean ( ' 20-10123456- ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a valid CUIT in XX-XXXXXXXX-X or XXXXXXXXXXXX format. ' ]
>> > f . clean ( ' 20-10123456-5 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Invalid CUIT. ' ]
>> > f . clean ( u ' 2-10123456-9 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Enter a valid CUIT in XX-XXXXXXXX-X or XXXXXXXXXXXX format. ' ]
>> > f . clean ( ' 27-10345678-1 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Invalid CUIT. ' ]
>> > f . clean ( u ' 27-10345678-1 ' )
Traceback ( most recent call last ) :
. . .
ValidationError : [ u ' Invalid CUIT. ' ]
>> > f . clean ( None )
u ' '
>> > f . clean ( ' ' )
u ' '
>> > f . clean ( u ' ' )
u ' '
2007-08-19 07:38:39 +00:00
"""