Ticket #12474: diff.diff

File diff.diff, 1.3 KB (added by Alex Gaynor, 15 years ago)
  • django/contrib/localflavor/us/models.py

    diff --git a/django/contrib/localflavor/us/models.py b/django/contrib/localflavor/us/models.py
    index 4cb6e68..1488fe8 100644
    a b  
    11from django.conf import settings
    22from django.utils.translation import ugettext_lazy as _
    3 from django.db.models.fields import Field, CharField
     3from django.db.models.fields import CharField
    44from django.contrib.localflavor.us.us_states import STATE_CHOICES
    55
    66class USStateField(CharField):
    class USStateField(CharField):  
    1212        kwargs['max_length'] = 2
    1313        super(USStateField, self).__init__(*args, **kwargs)
    1414
    15 class PhoneNumberField(Field):
     15class PhoneNumberField(CharField):
    1616
    1717    description = _("Phone number")
    18 
    19     def get_internal_type(self):
    20         return "PhoneNumberField"
    21 
    22     def db_type(self, connection):
    23         if connection.settings_dict['ENGINE'] == 'django.db.backends.oracle':
    24             return 'VARCHAR2(20)'
    25         else:
    26             return 'varchar(20)'
     18   
     19    def __init__(self, *args, **kwargs):
     20        kwargs['max_length'] = 20
     21        super(PhoneNumberField, self).__init__(*args, **kwargs)
    2722
    2823    def formfield(self, **kwargs):
    2924        from django.contrib.localflavor.us.forms import USPhoneNumberField
Back to Top