mirror of
https://github.com/django/django.git
synced 2025-01-10 18:36:05 +00:00
Backwards-incompatible change -- Renamed localflavor.usa to localflavor.us to match naming of other flavors.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4954 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
c7f6cd0243
commit
1245b5c01e
@ -761,7 +761,7 @@ class PhoneNumberField(IntegerField):
|
|||||||
validators.isValidPhone(field_data, all_data)
|
validators.isValidPhone(field_data, all_data)
|
||||||
|
|
||||||
def formfield(self, **kwargs):
|
def formfield(self, **kwargs):
|
||||||
from django.contrib.localflavor.usa.forms import USPhoneNumberField
|
from django.contrib.localflavor.us.forms import USPhoneNumberField
|
||||||
defaults = {'required': not self.blank, 'label': capfirst(self.verbose_name), 'help_text': self.help_text}
|
defaults = {'required': not self.blank, 'label': capfirst(self.verbose_name), 'help_text': self.help_text}
|
||||||
defaults.update(kwargs)
|
defaults.update(kwargs)
|
||||||
return USPhoneNumberField(**defaults)
|
return USPhoneNumberField(**defaults)
|
||||||
|
@ -6,7 +6,7 @@ localflavor_tests = r"""
|
|||||||
|
|
||||||
USZipCodeField validates that the data is either a five-digit U.S. zip code or
|
USZipCodeField validates that the data is either a five-digit U.S. zip code or
|
||||||
a zip+4.
|
a zip+4.
|
||||||
>>> from django.contrib.localflavor.usa.forms import USZipCodeField
|
>>> from django.contrib.localflavor.us.forms import USZipCodeField
|
||||||
>>> f = USZipCodeField()
|
>>> f = USZipCodeField()
|
||||||
>>> f.clean('60606')
|
>>> f.clean('60606')
|
||||||
u'60606'
|
u'60606'
|
||||||
@ -67,7 +67,7 @@ u''
|
|||||||
|
|
||||||
USPhoneNumberField validates that the data is a valid U.S. phone number,
|
USPhoneNumberField validates that the data is a valid U.S. phone number,
|
||||||
including the area code. It's normalized to XXX-XXX-XXXX format.
|
including the area code. It's normalized to XXX-XXX-XXXX format.
|
||||||
>>> from django.contrib.localflavor.usa.forms import USPhoneNumberField
|
>>> from django.contrib.localflavor.us.forms import USPhoneNumberField
|
||||||
>>> f = USPhoneNumberField()
|
>>> f = USPhoneNumberField()
|
||||||
>>> f.clean('312-555-1212')
|
>>> f.clean('312-555-1212')
|
||||||
u'312-555-1212'
|
u'312-555-1212'
|
||||||
@ -136,7 +136,7 @@ u''
|
|||||||
|
|
||||||
USStateField validates that the data is either an abbreviation or name of a
|
USStateField validates that the data is either an abbreviation or name of a
|
||||||
U.S. state.
|
U.S. state.
|
||||||
>>> from django.contrib.localflavor.usa.forms import USStateField
|
>>> from django.contrib.localflavor.us.forms import USStateField
|
||||||
>>> f = USStateField()
|
>>> f = USStateField()
|
||||||
>>> f.clean('il')
|
>>> f.clean('il')
|
||||||
u'IL'
|
u'IL'
|
||||||
@ -181,7 +181,7 @@ u''
|
|||||||
|
|
||||||
USStateSelect is a Select widget that uses a list of U.S. states/territories
|
USStateSelect is a Select widget that uses a list of U.S. states/territories
|
||||||
as its choices.
|
as its choices.
|
||||||
>>> from django.contrib.localflavor.usa.forms import USStateSelect
|
>>> from django.contrib.localflavor.us.forms import USStateSelect
|
||||||
>>> w = USStateSelect()
|
>>> w = USStateSelect()
|
||||||
>>> print w.render('state', 'IL')
|
>>> print w.render('state', 'IL')
|
||||||
<select name="state">
|
<select name="state">
|
||||||
@ -247,7 +247,7 @@ as its choices.
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
# USSocialSecurityNumberField #################################################
|
# USSocialSecurityNumberField #################################################
|
||||||
>>> from django.contrib.localflavor.usa.forms import USSocialSecurityNumberField
|
>>> from django.contrib.localflavor.us.forms import USSocialSecurityNumberField
|
||||||
>>> f = USSocialSecurityNumberField()
|
>>> f = USSocialSecurityNumberField()
|
||||||
>>> f.clean('987-65-4330')
|
>>> f.clean('987-65-4330')
|
||||||
u'987-65-4330'
|
u'987-65-4330'
|
||||||
|
Loading…
Reference in New Issue
Block a user