Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.5.x] Removed US localflavor-specific tests from core

Also fixes #9045.
Backport of 8248d14 from master.
  • Loading branch information...
commit fce779475e221e322a25dbf30dc25003e831afc2 1 parent c81e8e7
Claude Paroz authored December 08, 2012
3  docs/topics/forms/modelforms.txt
@@ -90,9 +90,6 @@ Model field                      Form field
90 90
 
91 91
 ``NullBooleanField``             ``CharField``
92 92
 
93  
-``PhoneNumberField``             ``USPhoneNumberField``
94  
-                                 (from ``django.contrib.localflavor.us``)
95  
-
96 93
 ``PositiveIntegerField``         ``IntegerField``
97 94
 
98 95
 ``PositiveSmallIntegerField``    ``IntegerField``
9  tests/modeltests/model_forms/models.py
@@ -91,15 +91,6 @@ class WriterProfile(models.Model):
91 91
     def __str__(self):
92 92
         return "%s is %s" % (self.writer, self.age)
93 93
 
94  
-from django.contrib.localflavor.us.models import PhoneNumberField
95  
-@python_2_unicode_compatible
96  
-class PhoneNumber(models.Model):
97  
-    phone = PhoneNumberField()
98  
-    description = models.CharField(max_length=20)
99  
-
100  
-    def __str__(self):
101  
-        return self.phone
102  
-
103 94
 @python_2_unicode_compatible
104 95
 class TextFile(models.Model):
105 96
     description = models.CharField(max_length=20)
14  tests/modeltests/model_forms/tests.py
@@ -18,7 +18,7 @@
18 18
 from .models import (Article, ArticleStatus, BetterWriter, BigInt, Book,
19 19
     Category, CommaSeparatedInteger, CustomFieldForExclusionModel, DerivedBook,
20 20
     DerivedPost, ExplicitPK, FlexibleDatePost, ImprovedArticle,
21  
-    ImprovedArticleWithParentLink, Inventory, PhoneNumber, Post, Price,
  21
+    ImprovedArticleWithParentLink, Inventory, Post, Price,
22 22
     Product, TextFile, Writer, WriterProfile, test_images)
23 23
 
24 24
 if test_images:
@@ -148,10 +148,6 @@ class WriterProfileForm(forms.ModelForm):
148 148
     class Meta:
149 149
         model = WriterProfile
150 150
 
151  
-class PhoneNumberForm(forms.ModelForm):
152  
-    class Meta:
153  
-        model = PhoneNumber
154  
-
155 151
 class TextFileForm(forms.ModelForm):
156 152
     class Meta:
157 153
         model = TextFile
@@ -167,7 +163,7 @@ class Media:
167 163
             'all': ('/some/form/css',)
168 164
         }
169 165
     class Meta:
170  
-        model = PhoneNumber
  166
+        model = TextFile
171 167
 
172 168
 class CommaSeparatedIntegerForm(forms.ModelForm):
173 169
    class Meta:
@@ -1149,12 +1145,6 @@ def test_with_data(self):
1149 1145
 </select></p>
1150 1146
 <p><label for="id_age">Age:</label> <input type="text" name="age" value="65" id="id_age" /></p>''' % (w_woodward.pk, w_bernstein.pk, bw.pk, w_royko.pk))
1151 1147
 
1152  
-    def test_phone_number_field(self):
1153  
-        f = PhoneNumberForm({'phone': '(312) 555-1212', 'description': 'Assistance'})
1154  
-        self.assertEqual(f.is_valid(), True)
1155  
-        self.assertEqual(f.cleaned_data['phone'], '312-555-1212')
1156  
-        self.assertEqual(f.cleaned_data['description'], 'Assistance')
1157  
-
1158 1148
     def test_file_field(self):
1159 1149
         # Test conditions when files is either not given or empty.
1160 1150
 
13  tests/regressiontests/serializers_regress/models.py
@@ -8,7 +8,6 @@
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 USStateField, PhoneNumberField
12 11
 
13 12
 # The following classes are for testing basic data
14 13
 # marshalling, including NULL values, where allowed.
@@ -58,9 +57,6 @@ class GenericIPAddressData(models.Model):
58 57
 class NullBooleanData(models.Model):
59 58
     data = models.NullBooleanField(null=True)
60 59
 
61  
-class PhoneData(models.Model):
62  
-    data = PhoneNumberField(null=True)
63  
-
64 60
 class PositiveIntegerData(models.Model):
65 61
     data = models.PositiveIntegerField(null=True)
66 62
 
@@ -79,9 +75,6 @@ class TextData(models.Model):
79 75
 class TimeData(models.Model):
80 76
     data = models.TimeField(null=True)
81 77
 
82  
-class USStateData(models.Model):
83  
-    data = USStateField(null=True)
84  
-
85 78
 class Tag(models.Model):
86 79
     """A tag on an item."""
87 80
     data = models.SlugField()
@@ -212,9 +205,6 @@ class GenericIPAddressPKData(models.Model):
212 205
 # class NullBooleanPKData(models.Model):
213 206
 #     data = models.NullBooleanField(primary_key=True)
214 207
 
215  
-class PhonePKData(models.Model):
216  
-    data = PhoneNumberField(primary_key=True)
217  
-
218 208
 class PositiveIntegerPKData(models.Model):
219 209
     data = models.PositiveIntegerField(primary_key=True)
220 210
 
@@ -233,9 +223,6 @@ class SmallPKData(models.Model):
233 223
 # class TimePKData(models.Model):
234 224
 #    data = models.TimeField(primary_key=True)
235 225
 
236  
-class USStatePKData(models.Model):
237  
-    data = USStateField(primary_key=True)
238  
-
239 226
 class ComplexModel(models.Model):
240 227
     field1 = models.CharField(max_length=10)
241 228
     field2 = models.CharField(max_length=10)
15  tests/regressiontests/serializers_regress/tests.py
@@ -28,14 +28,14 @@
28 28
 
29 29
 from .models import (BooleanData, CharData, DateData, DateTimeData, EmailData,
30 30
     FileData, FilePathData, DecimalData, FloatData, IntegerData, IPAddressData,
31  
-    GenericIPAddressData, NullBooleanData, PhoneData, PositiveIntegerData,
  31
+    GenericIPAddressData, NullBooleanData, PositiveIntegerData,
32 32
     PositiveSmallIntegerData, SlugData, SmallData, TextData, TimeData,
33  
-    USStateData, GenericData, Anchor, UniqueAnchor, FKData, M2MData, O2OData,
  33
+    GenericData, Anchor, UniqueAnchor, FKData, M2MData, O2OData,
34 34
     FKSelfData, M2MSelfData, FKDataToField, FKDataToO2O, M2MIntermediateData,
35 35
     Intermediate, BooleanPKData, CharPKData, EmailPKData, FilePathPKData,
36 36
     DecimalPKData, FloatPKData, IntegerPKData, IPAddressPKData,
37  
-    GenericIPAddressPKData, PhonePKData, PositiveIntegerPKData,
38  
-    PositiveSmallIntegerPKData, SlugPKData, SmallPKData, USStatePKData,
  37
+    GenericIPAddressPKData, PositiveIntegerPKData,
  38
+    PositiveSmallIntegerPKData, SlugPKData, SmallPKData,
39 39
     AutoNowDateTimeData, ModifyingSaveData, InheritAbstractModel, BaseModel,
40 40
     ExplicitInheritBaseModel, InheritBaseModel, ProxyBaseModel,
41 41
     ProxyProxyBaseModel, BigIntegerData, LengthModel, Tag, ComplexModel,
@@ -218,8 +218,6 @@ def inherited_compare(testcase, pk, klass, data):
218 218
     (data_obj, 100, NullBooleanData, True),
219 219
     (data_obj, 101, NullBooleanData, False),
220 220
     (data_obj, 102, NullBooleanData, None),
221  
-    (data_obj, 110, PhoneData, "212-634-5789"),
222  
-    (data_obj, 111, PhoneData, None),
223 221
     (data_obj, 120, PositiveIntegerData, 123456789),
224 222
     (data_obj, 121, PositiveIntegerData, None),
225 223
     (data_obj, 130, PositiveSmallIntegerData, 12),
@@ -239,9 +237,6 @@ def inherited_compare(testcase, pk, klass, data):
239 237
     (data_obj, 162, TextData, None),
240 238
     (data_obj, 170, TimeData, datetime.time(10,42,37)),
241 239
     (data_obj, 171, TimeData, None),
242  
-    (data_obj, 180, USStateData, "MA"),
243  
-    (data_obj, 181, USStateData, None),
244  
-    (data_obj, 182, USStateData, ""),
245 240
 
246 241
     (generic_obj, 200, GenericData, ['Generic Object 1', 'tag1', 'tag2']),
247 242
     (generic_obj, 201, GenericData, ['Generic Object 2', 'tag2', 'tag3']),
@@ -320,7 +315,6 @@ def inherited_compare(testcase, pk, klass, data):
320 315
     (pk_obj, 695, GenericIPAddressPKData, "fe80:1424:2223:6cff:fe8a:2e8a:2151:abcd"),
321 316
     # (pk_obj, 700, NullBooleanPKData, True),
322 317
     # (pk_obj, 701, NullBooleanPKData, False),
323  
-    (pk_obj, 710, PhonePKData, "212-634-5789"),
324 318
     (pk_obj, 720, PositiveIntegerPKData, 123456789),
325 319
     (pk_obj, 730, PositiveSmallIntegerPKData, 12),
326 320
     (pk_obj, 740, SlugPKData, "this-is-a-slug"),
@@ -332,7 +326,6 @@ def inherited_compare(testcase, pk, klass, data):
332 326
 # Several of them.
333 327
 # The end."""),
334 328
 #    (pk_obj, 770, TimePKData, datetime.time(10,42,37)),
335  
-    (pk_obj, 780, USStatePKData, "MA"),
336 329
 #     (pk_obj, 790, XMLPKData, "<foo></foo>"),
337 330
 
338 331
     (data_obj, 800, AutoNowDateTimeData, datetime.datetime(2006,6,16,10,42,37)),

0 notes on commit fce7794

Please sign in to comment.
Something went wrong with that request. Please try again.