mirror of https://github.com/django/django.git
Fixed #28776 -- Fixed a/an/and typos in docs and comments.
This commit is contained in:
parent
5587485d49
commit
6c0042430e
|
@ -50,7 +50,7 @@ def shortcut(request, content_type_id, object_id):
|
|||
|
||||
opts = obj._meta
|
||||
|
||||
# First, look for an many-to-many relationship to Site.
|
||||
# First, look for a many-to-many relationship to Site.
|
||||
for field in opts.many_to_many:
|
||||
if field.remote_field.model is Site:
|
||||
try:
|
||||
|
|
|
@ -204,7 +204,7 @@ class BaseStorageFinder(BaseFinder):
|
|||
raise ImproperlyConfigured("The staticfiles storage finder %r "
|
||||
"doesn't have a storage class "
|
||||
"assigned." % self.__class__)
|
||||
# Make sure we have an storage instance here.
|
||||
# Make sure we have a storage instance here.
|
||||
if not isinstance(self.storage, (Storage, LazyObject)):
|
||||
self.storage = self.storage()
|
||||
super().__init__(*args, **kwargs)
|
||||
|
|
|
@ -15,7 +15,7 @@ __all__ = ('UploadedFile', 'TemporaryUploadedFile', 'InMemoryUploadedFile',
|
|||
|
||||
class UploadedFile(File):
|
||||
"""
|
||||
A abstract uploaded file (``TemporaryUploadedFile`` and
|
||||
An abstract uploaded file (``TemporaryUploadedFile`` and
|
||||
``InMemoryUploadedFile`` are the built-in concrete subclasses).
|
||||
|
||||
An ``UploadedFile`` object behaves somewhat like a file object and
|
||||
|
|
|
@ -21,7 +21,7 @@ class EmailBackend(ConsoleEmailBackend):
|
|||
if not isinstance(self.file_path, str):
|
||||
raise ImproperlyConfigured('Path for saving emails is invalid: %r' % self.file_path)
|
||||
self.file_path = os.path.abspath(self.file_path)
|
||||
# Make sure that self.file_path is an directory if it exists.
|
||||
# Make sure that self.file_path is a directory if it exists.
|
||||
if os.path.exists(self.file_path) and not os.path.isdir(self.file_path):
|
||||
raise ImproperlyConfigured(
|
||||
'Path for saving email messages exists, but is not a directory: %s' % self.file_path
|
||||
|
|
|
@ -72,7 +72,7 @@ class Command(BaseCommand):
|
|||
self.loaddata(fixture_labels)
|
||||
|
||||
# Close the DB connection -- unless we're still in a transaction. This
|
||||
# is required as a workaround for an edge case in MySQL: if the same
|
||||
# is required as a workaround for an edge case in MySQL: if the same
|
||||
# connection is used to create tables, load data, and query, the query
|
||||
# can return incorrect results. See Django #7572, MySQL #37735.
|
||||
if transaction.get_autocommit(self.using):
|
||||
|
|
|
@ -63,7 +63,7 @@ class RelatedIn(In):
|
|||
if isinstance(self.lhs, MultiColSource):
|
||||
# For multicolumn lookups we need to build a multicolumn where clause.
|
||||
# This clause is either a SubqueryConstraint (for values that need to be compiled to
|
||||
# SQL) or a OR-combined list of (col1 = val1 AND col2 = val2 AND ...) clauses.
|
||||
# SQL) or an OR-combined list of (col1 = val1 AND col2 = val2 AND ...) clauses.
|
||||
from django.db.models.sql.where import WhereNode, SubqueryConstraint, AND, OR
|
||||
|
||||
root_constraint = WhereNode(connector=OR)
|
||||
|
|
|
@ -489,7 +489,7 @@ class JsonResponse(HttpResponse):
|
|||
:param data: Data to be dumped into json. By default only ``dict`` objects
|
||||
are allowed to be passed due to a security flaw before EcmaScript 5. See
|
||||
the ``safe`` parameter for more information.
|
||||
:param encoder: Should be an json encoder class. Defaults to
|
||||
:param encoder: Should be a json encoder class. Defaults to
|
||||
``django.core.serializers.json.DjangoJSONEncoder``.
|
||||
:param safe: Controls if only ``dict`` objects may be serialized. Defaults
|
||||
to ``True``.
|
||||
|
|
|
@ -79,8 +79,8 @@ def get_object_or_404(klass, *args, **kwargs):
|
|||
klass may be a Model, Manager, or QuerySet object. All other passed
|
||||
arguments and keyword arguments are used in the get() query.
|
||||
|
||||
Note: Like with get(), an MultipleObjectsReturned will be raised if more than one
|
||||
object is found.
|
||||
Like with QuerySet.get(), MultipleObjectsReturned is raised if more than
|
||||
one object is found.
|
||||
"""
|
||||
queryset = _get_queryset(klass)
|
||||
try:
|
||||
|
|
|
@ -159,7 +159,7 @@ class FormView(TemplateResponseMixin, BaseFormView):
|
|||
|
||||
class BaseCreateView(ModelFormMixin, ProcessFormView):
|
||||
"""
|
||||
Base view for creating an new object instance.
|
||||
Base view for creating a new object instance.
|
||||
|
||||
Using this base class requires subclassing to provide a response mixin.
|
||||
"""
|
||||
|
|
|
@ -1862,7 +1862,7 @@ __ https://github.com/django/django/blob/master/django/utils/log.py
|
|||
Default: ``'logging.config.dictConfig'``
|
||||
|
||||
A path to a callable that will be used to configure logging in the
|
||||
Django project. Points at a instance of Python's :ref:`dictConfig
|
||||
Django project. Points at an instance of Python's :ref:`dictConfig
|
||||
<logging-config-dictschema>` configuration method by default.
|
||||
|
||||
If you set :setting:`LOGGING_CONFIG` to ``None``, the logging
|
||||
|
|
|
@ -207,7 +207,7 @@ detail in :doc:`the ORM aggregation documentation </topics/db/aggregation>`.
|
|||
Query expressions
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
Queries can now refer to a another field on the query and can traverse
|
||||
Queries can now refer to another field on the query and can traverse
|
||||
relationships to refer to fields on related models. This is implemented in the
|
||||
new :class:`~django.db.models.F` object; for full details, including examples,
|
||||
consult the :class:`F expressions documentation <django.db.models.F>`.
|
||||
|
|
|
@ -354,7 +354,7 @@ class SystemChecksTestCase(SimpleTestCase):
|
|||
def test_generic_inline_model_admin_non_generic_model(self):
|
||||
"""
|
||||
A model without a GenericForeignKey raises problems if it's included
|
||||
in an GenericInlineModelAdmin definition.
|
||||
in a GenericInlineModelAdmin definition.
|
||||
"""
|
||||
class BookInline(GenericStackedInline):
|
||||
model = Book
|
||||
|
|
|
@ -57,8 +57,8 @@ class UserModelChecksTests(SimpleTestCase):
|
|||
@override_settings(AUTH_USER_MODEL='auth_tests.CustomUserNonUniqueUsername')
|
||||
def test_username_non_unique(self):
|
||||
"""
|
||||
A non-unique USERNAME_FIELD should raise an error only if we use the
|
||||
default authentication backend. Otherwise, an warning should be raised.
|
||||
A non-unique USERNAME_FIELD raises an error only if the default
|
||||
authentication backend is used. Otherwise, a warning is raised.
|
||||
"""
|
||||
errors = checks.run_checks()
|
||||
self.assertEqual(errors, [
|
||||
|
|
|
@ -244,7 +244,7 @@ class DimensionClosingBug(unittest.TestCase):
|
|||
"""
|
||||
# We need to inject a modified open() builtin into the images module
|
||||
# that checks if the file was closed properly if the function is
|
||||
# called with a filename instead of an file object.
|
||||
# called with a filename instead of a file object.
|
||||
# get_image_dimensions will call our catching_open instead of the
|
||||
# regular builtin one.
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ class Group(models.Model):
|
|||
return self.name
|
||||
|
||||
|
||||
# A set of models that use an non-abstract inherited model as the 'through' model.
|
||||
# A set of models that use a non-abstract inherited model as the 'through' model.
|
||||
class A(models.Model):
|
||||
a_text = models.CharField(max_length=20)
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ class ManagersRegressionTests(TestCase):
|
|||
AbstractBase3.objects.all()
|
||||
|
||||
def test_custom_abstract_manager(self):
|
||||
# Accessing the manager on an abstract model with an custom
|
||||
# Accessing the manager on an abstract model with a custom
|
||||
# manager should raise an attribute error with an appropriate
|
||||
# message.
|
||||
msg = "Manager isn't available; AbstractBase2 is abstract"
|
||||
|
|
|
@ -570,12 +570,12 @@ class ManyToOneTests(TestCase):
|
|||
Third.objects.create(name='Third 1')
|
||||
Third.objects.create(name='Third 2')
|
||||
th = Third(name="testing")
|
||||
# The object isn't saved an thus the relation field is null - we won't even
|
||||
# The object isn't saved and thus the relation field is null - we won't even
|
||||
# execute a query in this case.
|
||||
with self.assertNumQueries(0):
|
||||
self.assertEqual(th.child_set.count(), 0)
|
||||
th.save()
|
||||
# Now the model is saved, so we will need to execute an query.
|
||||
# Now the model is saved, so we will need to execute a query.
|
||||
with self.assertNumQueries(1):
|
||||
self.assertEqual(th.child_set.count(), 0)
|
||||
|
||||
|
@ -591,7 +591,7 @@ class ManyToOneTests(TestCase):
|
|||
|
||||
self.assertEqual(public_student.school, public_school)
|
||||
|
||||
# Make sure the base manager is used so that an student can still access
|
||||
# Make sure the base manager is used so that a student can still access
|
||||
# its related school even if the default manager doesn't normally
|
||||
# allow it.
|
||||
self.assertEqual(private_student.school, private_school)
|
||||
|
|
|
@ -1146,7 +1146,7 @@ class AutodetectorTests(TestCase):
|
|||
# a CreateModel operation w/o any definition on the original model
|
||||
model_state_not_specified = ModelState("a", "model", [("id", models.AutoField(primary_key=True))])
|
||||
# Explicitly testing for None, since this was the issue in #23452 after
|
||||
# a AlterFooTogether operation with e.g. () as value
|
||||
# an AlterFooTogether operation with e.g. () as value
|
||||
model_state_none = ModelState("a", "model", [
|
||||
("id", models.AutoField(primary_key=True))
|
||||
], {
|
||||
|
|
|
@ -155,7 +155,7 @@ class MigrateTests(MigrationTestBase):
|
|||
# Fails because "migrations_tribble" does not exist but needs to in
|
||||
# order to make --fake-initial work.
|
||||
call_command("migrate", "migrations", fake_initial=True, verbosity=0)
|
||||
# Fake a apply
|
||||
# Fake an apply
|
||||
call_command("migrate", "migrations", fake=True, verbosity=0)
|
||||
call_command("migrate", "migrations", fake=True, verbosity=0, database="other")
|
||||
# Unmigrate everything
|
||||
|
|
|
@ -188,7 +188,7 @@ class ModelTests(TestCase):
|
|||
|
||||
@skipUnlessDBFeature("supports_timezones")
|
||||
def test_timezones(self):
|
||||
# Saving an updating with timezone-aware datetime Python objects.
|
||||
# Saving and updating with timezone-aware datetime Python objects.
|
||||
# Regression test for #10443.
|
||||
# The idea is that all these creations and saving should work without
|
||||
# crashing. It's not rocket science.
|
||||
|
|
|
@ -69,7 +69,7 @@ class ManagerMixin(models.Model):
|
|||
|
||||
class OtherPerson(Person, ManagerMixin):
|
||||
"""
|
||||
A class with the default manager from Person, plus an secondary manager.
|
||||
A class with the default manager from Person, plus a secondary manager.
|
||||
"""
|
||||
class Meta:
|
||||
proxy = True
|
||||
|
|
|
@ -235,7 +235,7 @@ class RequestsTests(SimpleTestCase):
|
|||
self.assertEqual(response.cookies['c']['expires'], '')
|
||||
|
||||
def test_far_expiration(self):
|
||||
"Cookie will expire when an distant expiration time is provided"
|
||||
"Cookie will expire when a distant expiration time is provided"
|
||||
response = HttpResponse()
|
||||
response.set_cookie('datetime', expires=datetime(2028, 1, 1, 4, 5, 6))
|
||||
datetime_cookie = response.cookies['datetime']
|
||||
|
|
|
@ -1 +1 @@
|
|||
not really a EOT ;)
|
||||
not really an EOT ;)
|
|
@ -96,10 +96,10 @@ class TestHashedFiles:
|
|||
|
||||
def test_path_with_querystring_and_fragment(self):
|
||||
relpath = self.hashed_file_path("cached/css/fragments.css")
|
||||
self.assertEqual(relpath, "cached/css/fragments.c4e6753b52d3.css")
|
||||
self.assertEqual(relpath, "cached/css/fragments.a60c0e74834f.css")
|
||||
with storage.staticfiles_storage.open(relpath) as relfile:
|
||||
content = relfile.read()
|
||||
self.assertIn(b'fonts/font.a4b0478549d0.eot?#iefix', content)
|
||||
self.assertIn(b'fonts/font.b9b105392eb8.eot?#iefix', content)
|
||||
self.assertIn(b'fonts/font.b8d603e42714.svg#webfontIyfZbseF', content)
|
||||
self.assertIn(b'fonts/font.b8d603e42714.svg#path/to/../../fonts/font.svg', content)
|
||||
self.assertIn(b'data:font/woff;charset=utf-8;base64,d09GRgABAAAAADJoAA0AAAAAR2QAAQAAAAAAAAAAAAA', content)
|
||||
|
|
Loading…
Reference in New Issue