Ticket #8664: 8664-1.2.diff
File 8664-1.2.diff, 3.3 KB (added by , 16 years ago) |
---|
-
django/db/models/fields/__init__.py
725 725 defaults.update(kwargs) 726 726 return super(NullBooleanField, self).formfield(**defaults) 727 727 728 class PhoneNumberField(Field):729 def get_internal_type(self):730 return "PhoneNumberField"731 732 def formfield(self, **kwargs):733 from django.contrib.localflavor.us.forms import USPhoneNumberField734 defaults = {'form_class': USPhoneNumberField}735 defaults.update(kwargs)736 return super(PhoneNumberField, self).formfield(**defaults)737 738 728 class PositiveIntegerField(IntegerField): 739 729 def get_internal_type(self): 740 730 return "PositiveIntegerField" -
django/contrib/localflavor/us/models.py
1 from django.db.models.fields import Field 2 3 class PhoneNumberField(Field): 4 def get_internal_type(self): 5 return "PhoneNumberField" 6 7 def formfield(self, **kwargs): 8 from django.contrib.localflavor.us.forms import USPhoneNumberField 9 defaults = {'form_class': USPhoneNumberField} 10 defaults.update(kwargs) 11 return super(PhoneNumberField, self).formfield(**defaults) -
tests/modeltests/model_forms/models.py
70 70 pass 71 71 72 72 class PhoneNumber(models.Model): 73 phone = models.PhoneNumberField() 73 from django.contrib.localflavor.us.models import PhoneNumberField 74 phone = PhoneNumberField() 74 75 description = models.CharField(max_length=20) 75 76 76 77 def __unicode__(self): -
tests/regressiontests/serializers_regress/models.py
8 8 from django.db import models 9 9 from django.contrib.contenttypes import generic 10 10 from django.contrib.contenttypes.models import ContentType 11 from django.contrib.localflavor.us.models import PhoneNumberField 11 12 12 13 # The following classes are for testing basic data 13 14 # marshalling, including NULL values. … … 52 53 data = models.NullBooleanField(null=True) 53 54 54 55 class PhoneData(models.Model): 55 data = models.PhoneNumberField(null=True)56 data = PhoneNumberField(null=True) 56 57 57 58 class PositiveIntegerData(models.Model): 58 59 data = models.PositiveIntegerField(null=True) … … 188 189 # data = models.NullBooleanField(primary_key=True) 189 190 190 191 class PhonePKData(models.Model): 191 data = models.PhoneNumberField(primary_key=True)192 data = PhoneNumberField(primary_key=True) 192 193 193 194 class PositiveIntegerPKData(models.Model): 194 195 data = models.PositiveIntegerField(primary_key=True) … … 251 252 class ExplicitInheritBaseModel(BaseModel): 252 253 parent = models.OneToOneField(BaseModel) 253 254 child_data = models.IntegerField()