mirror of
https://github.com/django/django.git
synced 2025-04-22 00:04:43 +00:00
Americanized some spellings.
This commit is contained in:
parent
494d2dc316
commit
6ef0f5bc27
@ -73,7 +73,7 @@ class StringAgg(_DeprecatedOrdering, _StringAgg):
|
||||
warnings.warn(
|
||||
"delimiter: str will be resolved as a field reference instead "
|
||||
"of a string literal on Django 7.0. Pass "
|
||||
f"`delimiter=Value({delimiter!r})` to preserve the previous behaviour.",
|
||||
f"`delimiter=Value({delimiter!r})` to preserve the previous behavior.",
|
||||
category=RemovedInDjango70Warning,
|
||||
stacklevel=2,
|
||||
)
|
||||
|
@ -128,7 +128,7 @@ class Migration:
|
||||
self.app_label, schema_editor, old_state, project_state
|
||||
)
|
||||
else:
|
||||
# Normal behaviour
|
||||
# Normal behavior
|
||||
operation.database_forwards(
|
||||
self.app_label, schema_editor, old_state, project_state
|
||||
)
|
||||
@ -189,7 +189,7 @@ class Migration:
|
||||
self.app_label, schema_editor, from_state, to_state
|
||||
)
|
||||
else:
|
||||
# Normal behaviour
|
||||
# Normal behavior
|
||||
operation.database_backwards(
|
||||
self.app_label, schema_editor, from_state, to_state
|
||||
)
|
||||
|
@ -1379,7 +1379,7 @@ precedence. For a \fB\-\-verbosity\fP of 2 or higher, the automatically imported
|
||||
objects will be listed. To disable automatic importing entirely, use the
|
||||
\fB\-\-no\-imports\fP flag.
|
||||
.sp
|
||||
See the guide on \fI\%customizing this behaviour\fP to add or remove automatic imports.
|
||||
See the guide on \fI\%customizing this behavior\fP to add or remove automatic imports.
|
||||
.sp
|
||||
Automatic models import was added.
|
||||
|
||||
|
@ -1071,7 +1071,7 @@ precedence. For a ``--verbosity`` of 2 or higher, the automatically imported
|
||||
objects will be listed. To disable automatic importing entirely, use the
|
||||
``--no-imports`` flag.
|
||||
|
||||
See the guide on :ref:`customizing this behaviour
|
||||
See the guide on :ref:`customizing this behavior
|
||||
<customizing-shell-auto-imports>` to add or remove automatic imports.
|
||||
|
||||
.. versionchanged:: 5.2
|
||||
|
@ -1940,9 +1940,9 @@ class AdminViewFormUrlTest(TestCase):
|
||||
reverse("admin:admin_views_restaurant_add", current_app=self.current_app),
|
||||
{"name": "test_value"},
|
||||
)
|
||||
# this would be the usual behaviour
|
||||
# this would be the usual behavior
|
||||
self.assertNotContains(response, 'value="test_value"')
|
||||
# this is the overridden behaviour
|
||||
# this is the overridden behavior
|
||||
self.assertContains(response, 'value="overridden_value"')
|
||||
|
||||
|
||||
@ -8806,7 +8806,7 @@ class GetFormsetsWithInlinesArgumentTest(TestCase):
|
||||
@override_settings(ROOT_URLCONF="admin_views.urls")
|
||||
class AdminSiteFinalCatchAllPatternTests(TestCase):
|
||||
"""
|
||||
Verifies the behaviour of the admin catch-all view.
|
||||
Verifies the behavior of the admin catch-all view.
|
||||
|
||||
* Anonynous/non-staff users are redirected to login for all URLs, whether
|
||||
otherwise valid or not.
|
||||
|
@ -631,7 +631,7 @@ class LookupTransformCallOrderTests(SimpleTestCase):
|
||||
self.assertEqual(TrackCallsYearTransform.call_order, ["lookup"])
|
||||
|
||||
|
||||
class CustomisedMethodsTests(SimpleTestCase):
|
||||
class CustomizedMethodsTests(SimpleTestCase):
|
||||
def test_overridden_get_lookup(self):
|
||||
q = CustomModel.objects.filter(field__lookupfunc_monkeys=3)
|
||||
self.assertIn("monkeys()", str(q.query))
|
||||
|
@ -731,7 +731,7 @@ class TestCachedPathInfo(TestCase):
|
||||
|
||||
ForeignObjectRel implements __getstate__(), so copy and pickle modules
|
||||
both use that, but ForeignObject implements __reduce__() and __copy__()
|
||||
separately, so doesn't share the same behaviour.
|
||||
separately, so doesn't share the same behavior.
|
||||
"""
|
||||
foreign_object_rel = Membership._meta.get_field("person").remote_field
|
||||
# Trigger storage of cached_property into ForeignObjectRel's __dict__.
|
||||
|
@ -374,7 +374,7 @@ class FlexibleDatePost(models.Model):
|
||||
posted = models.DateField(blank=True, null=True)
|
||||
|
||||
|
||||
class Colour(models.Model):
|
||||
class Color(models.Model):
|
||||
name = models.CharField(max_length=50)
|
||||
|
||||
def __iter__(self):
|
||||
@ -384,9 +384,9 @@ class Colour(models.Model):
|
||||
return self.name
|
||||
|
||||
|
||||
class ColourfulItem(models.Model):
|
||||
class ColorfulItem(models.Model):
|
||||
name = models.CharField(max_length=50)
|
||||
colours = models.ManyToManyField(Colour)
|
||||
colors = models.ManyToManyField(Color)
|
||||
|
||||
|
||||
class CustomErrorMessage(models.Model):
|
||||
|
@ -38,8 +38,8 @@ from .models import (
|
||||
Book,
|
||||
Category,
|
||||
Character,
|
||||
Colour,
|
||||
ColourfulItem,
|
||||
Color,
|
||||
ColorfulItem,
|
||||
ConstraintsModel,
|
||||
CustomErrorMessage,
|
||||
CustomFF,
|
||||
@ -2998,18 +2998,18 @@ class OtherModelFormTests(TestCase):
|
||||
"""
|
||||
ModelChoiceField should respect a prefetch_related() on its queryset.
|
||||
"""
|
||||
blue = Colour.objects.create(name="blue")
|
||||
red = Colour.objects.create(name="red")
|
||||
multicolor_item = ColourfulItem.objects.create()
|
||||
multicolor_item.colours.add(blue, red)
|
||||
red_item = ColourfulItem.objects.create()
|
||||
red_item.colours.add(red)
|
||||
blue = Color.objects.create(name="blue")
|
||||
red = Color.objects.create(name="red")
|
||||
multicolor_item = ColorfulItem.objects.create()
|
||||
multicolor_item.colors.add(blue, red)
|
||||
red_item = ColorfulItem.objects.create()
|
||||
red_item.colors.add(red)
|
||||
|
||||
class ColorModelChoiceField(forms.ModelChoiceField):
|
||||
def label_from_instance(self, obj):
|
||||
return ", ".join(c.name for c in obj.colours.all())
|
||||
return ", ".join(c.name for c in obj.colors.all())
|
||||
|
||||
field = ColorModelChoiceField(ColourfulItem.objects.prefetch_related("colours"))
|
||||
field = ColorModelChoiceField(ColorfulItem.objects.prefetch_related("colors"))
|
||||
# CPython < 3.14 calls ModelChoiceField.__len__() when coercing to
|
||||
# tuple. PyPy and Python 3.14+ don't call __len__() and so .count()
|
||||
# isn't called on the QuerySet. The following would trigger an extra
|
||||
@ -3091,13 +3091,13 @@ class OtherModelFormTests(TestCase):
|
||||
)
|
||||
|
||||
def test_iterable_model_m2m(self):
|
||||
class ColourfulItemForm(forms.ModelForm):
|
||||
class ColorfulItemForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = ColourfulItem
|
||||
model = ColorfulItem
|
||||
fields = "__all__"
|
||||
|
||||
colour = Colour.objects.create(name="Blue")
|
||||
form = ColourfulItemForm()
|
||||
color = Color.objects.create(name="Blue")
|
||||
form = ColorfulItemForm()
|
||||
self.maxDiff = 1024
|
||||
self.assertHTMLEqual(
|
||||
form.as_p(),
|
||||
@ -3105,12 +3105,12 @@ class OtherModelFormTests(TestCase):
|
||||
<p>
|
||||
<label for="id_name">Name:</label>
|
||||
<input id="id_name" type="text" name="name" maxlength="50" required></p>
|
||||
<p><label for="id_colours">Colours:</label>
|
||||
<select multiple name="colours" id="id_colours" required>
|
||||
<p><label for="id_colors">Colors:</label>
|
||||
<select multiple name="colors" id="id_colors" required>
|
||||
<option value="%(blue_pk)s">Blue</option>
|
||||
</select></p>
|
||||
"""
|
||||
% {"blue_pk": colour.pk},
|
||||
% {"blue_pk": color.pk},
|
||||
)
|
||||
|
||||
def test_callable_field_default(self):
|
||||
@ -3709,13 +3709,13 @@ class StrictAssignmentTests(SimpleTestCase):
|
||||
class ModelToDictTests(TestCase):
|
||||
def test_many_to_many(self):
|
||||
"""Data for a ManyToManyField is a list rather than a lazy QuerySet."""
|
||||
blue = Colour.objects.create(name="blue")
|
||||
red = Colour.objects.create(name="red")
|
||||
item = ColourfulItem.objects.create()
|
||||
item.colours.set([blue])
|
||||
data = model_to_dict(item)["colours"]
|
||||
blue = Color.objects.create(name="blue")
|
||||
red = Color.objects.create(name="red")
|
||||
item = ColorfulItem.objects.create()
|
||||
item.colors.set([blue])
|
||||
data = model_to_dict(item)["colors"]
|
||||
self.assertEqual(data, [blue])
|
||||
item.colours.set([red])
|
||||
item.colors.set([red])
|
||||
# If data were a QuerySet, it would be reevaluated here and give "red"
|
||||
# instead of the original value.
|
||||
self.assertEqual(data, [blue])
|
||||
|
@ -658,7 +658,7 @@ class TestGeneralAggregate(PostgreSQLTestCase):
|
||||
msg = (
|
||||
"delimiter: str will be resolved as a field reference instead "
|
||||
'of a string literal on Django 7.0. Pass `delimiter=Value("\'")` to '
|
||||
"preserve the previous behaviour."
|
||||
"preserve the previous behavior."
|
||||
)
|
||||
|
||||
with self.assertWarnsMessage(RemovedInDjango70Warning, msg) as ctx:
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- This is a customised template -->
|
||||
<!-- This is a customized template -->
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
{% spaceless %}
|
||||
{% for url in urlset %}
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- This is a customised template -->
|
||||
<!-- This is a customized template -->
|
||||
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
{% spaceless %}
|
||||
{% for site in sitemaps %}
|
||||
|
@ -68,7 +68,7 @@ class HTTPSitemapTests(SitemapTestsBase):
|
||||
"A simple sitemap index can be rendered with a custom template"
|
||||
response = self.client.get("/simple/custom-lastmod-index.xml")
|
||||
expected_content = """<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- This is a customised template -->
|
||||
<!-- This is a customized template -->
|
||||
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
<sitemap><loc>%s/simple/sitemap-simple.xml</loc><lastmod>%s</lastmod></sitemap>
|
||||
</sitemapindex>
|
||||
@ -140,7 +140,7 @@ class HTTPSitemapTests(SitemapTestsBase):
|
||||
"A simple sitemap can be rendered with a custom template"
|
||||
response = self.client.get("/simple/custom-sitemap.xml")
|
||||
expected_content = """<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- This is a customised template -->
|
||||
<!-- This is a customized template -->
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
<url><loc>%s/location/</loc><lastmod>%s</lastmod><changefreq>never</changefreq><priority>0.5</priority></url>
|
||||
</urlset>
|
||||
|
Loading…
x
Reference in New Issue
Block a user