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