-
diff --git a/django/contrib/contenttypes/views.py b/django/contrib/contenttypes/views.py
a
|
b
|
def shortcut(request, content_type_id, object_id):
|
50 | 50 | |
51 | 51 | opts = obj._meta |
52 | 52 | |
53 | | # First, look for an many-to-many relationship to Site. |
| 53 | # First, look for a many-to-many relationship to Site. |
54 | 54 | for field in opts.many_to_many: |
55 | 55 | if field.remote_field.model is Site: |
56 | 56 | try: |
-
diff --git a/django/contrib/staticfiles/finders.py b/django/contrib/staticfiles/finders.py
a
|
b
|
class BaseStorageFinder(BaseFinder):
|
204 | 204 | raise ImproperlyConfigured("The staticfiles storage finder %r " |
205 | 205 | "doesn't have a storage class " |
206 | 206 | "assigned." % self.__class__) |
207 | | # Make sure we have an storage instance here. |
| 207 | # Make sure we have a storage instance here. |
208 | 208 | if not isinstance(self.storage, (Storage, LazyObject)): |
209 | 209 | self.storage = self.storage() |
210 | 210 | super().__init__(*args, **kwargs) |
-
diff --git a/django/core/files/uploadedfile.py b/django/core/files/uploadedfile.py
a
|
b
|
__all__ = ('UploadedFile', 'TemporaryUploadedFile', 'InMemoryUploadedFile',
|
15 | 15 | |
16 | 16 | class UploadedFile(File): |
17 | 17 | """ |
18 | | A abstract uploaded file (``TemporaryUploadedFile`` and |
| 18 | An abstract uploaded file (``TemporaryUploadedFile`` and |
19 | 19 | ``InMemoryUploadedFile`` are the built-in concrete subclasses). |
20 | 20 | |
21 | 21 | An ``UploadedFile`` object behaves somewhat like a file object and |
-
diff --git a/django/core/mail/backends/filebased.py b/django/core/mail/backends/filebased.py
a
|
b
|
class EmailBackend(ConsoleEmailBackend):
|
21 | 21 | if not isinstance(self.file_path, str): |
22 | 22 | raise ImproperlyConfigured('Path for saving emails is invalid: %r' % self.file_path) |
23 | 23 | self.file_path = os.path.abspath(self.file_path) |
24 | | # Make sure that self.file_path is an directory if it exists. |
| 24 | # Make sure that self.file_path is a directory if it exists. |
25 | 25 | if os.path.exists(self.file_path) and not os.path.isdir(self.file_path): |
26 | 26 | raise ImproperlyConfigured( |
27 | 27 | 'Path for saving email messages exists, but is not a directory: %s' % self.file_path |
-
diff --git a/django/core/management/commands/loaddata.py b/django/core/management/commands/loaddata.py
a
|
b
|
class Command(BaseCommand):
|
72 | 72 | self.loaddata(fixture_labels) |
73 | 73 | |
74 | 74 | # Close the DB connection -- unless we're still in a transaction. This |
75 | | # is required as a workaround for an edge case in MySQL: if the same |
| 75 | # is required as a workaround for an edge case in MySQL: if the same |
76 | 76 | # connection is used to create tables, load data, and query, the query |
77 | 77 | # can return incorrect results. See Django #7572, MySQL #37735. |
78 | 78 | if transaction.get_autocommit(self.using): |
-
diff --git a/django/db/models/fields/related_lookups.py b/django/db/models/fields/related_lookups.py
a
|
b
|
class RelatedIn(In):
|
63 | 63 | if isinstance(self.lhs, MultiColSource): |
64 | 64 | # For multicolumn lookups we need to build a multicolumn where clause. |
65 | 65 | # This clause is either a SubqueryConstraint (for values that need to be compiled to |
66 | | # SQL) or a OR-combined list of (col1 = val1 AND col2 = val2 AND ...) clauses. |
| 66 | # SQL) or an OR-combined list of (col1 = val1 AND col2 = val2 AND ...) clauses. |
67 | 67 | from django.db.models.sql.where import WhereNode, SubqueryConstraint, AND, OR |
68 | 68 | |
69 | 69 | root_constraint = WhereNode(connector=OR) |
-
diff --git a/django/http/response.py b/django/http/response.py
a
|
b
|
class JsonResponse(HttpResponse):
|
489 | 489 | :param data: Data to be dumped into json. By default only ``dict`` objects |
490 | 490 | are allowed to be passed due to a security flaw before EcmaScript 5. See |
491 | 491 | the ``safe`` parameter for more information. |
492 | | :param encoder: Should be an json encoder class. Defaults to |
| 492 | :param encoder: Should be a json encoder class. Defaults to |
493 | 493 | ``django.core.serializers.json.DjangoJSONEncoder``. |
494 | 494 | :param safe: Controls if only ``dict`` objects may be serialized. Defaults |
495 | 495 | to ``True``. |
-
diff --git a/django/shortcuts.py b/django/shortcuts.py
a
|
b
|
def get_object_or_404(klass, *args, **kwargs):
|
79 | 79 | klass may be a Model, Manager, or QuerySet object. All other passed |
80 | 80 | arguments and keyword arguments are used in the get() query. |
81 | 81 | |
82 | | Note: Like with get(), an MultipleObjectsReturned will be raised if more than one |
| 82 | Note: Like with get(), a MultipleObjectsReturned will be raised if more than one |
83 | 83 | object is found. |
84 | 84 | """ |
85 | 85 | queryset = _get_queryset(klass) |
-
diff --git a/django/views/generic/edit.py b/django/views/generic/edit.py
a
|
b
|
class FormView(TemplateResponseMixin, BaseFormView):
|
159 | 159 | |
160 | 160 | class BaseCreateView(ModelFormMixin, ProcessFormView): |
161 | 161 | """ |
162 | | Base view for creating an new object instance. |
| 162 | Base view for creating a new object instance. |
163 | 163 | |
164 | 164 | Using this base class requires subclassing to provide a response mixin. |
165 | 165 | """ |
-
diff --git a/docs/ref/settings.txt b/docs/ref/settings.txt
a
|
b
|
__ https://github.com/django/django/blob/master/django/utils/log.py
|
1862 | 1862 | Default: ``'logging.config.dictConfig'`` |
1863 | 1863 | |
1864 | 1864 | A path to a callable that will be used to configure logging in the |
1865 | | Django project. Points at a instance of Python's :ref:`dictConfig |
| 1865 | Django project. Points at an instance of Python's :ref:`dictConfig |
1866 | 1866 | <logging-config-dictschema>` configuration method by default. |
1867 | 1867 | |
1868 | 1868 | If you set :setting:`LOGGING_CONFIG` to ``None``, the logging |
-
diff --git a/docs/releases/1.1.txt b/docs/releases/1.1.txt
a
|
b
|
detail in :doc:`the ORM aggregation documentation </topics/db/aggregation>`.
|
207 | 207 | Query expressions |
208 | 208 | ~~~~~~~~~~~~~~~~~ |
209 | 209 | |
210 | | Queries can now refer to a another field on the query and can traverse |
| 210 | Queries can now refer to another field on the query and can traverse |
211 | 211 | relationships to refer to fields on related models. This is implemented in the |
212 | 212 | new :class:`~django.db.models.F` object; for full details, including examples, |
213 | 213 | consult the :class:`F expressions documentation <django.db.models.F>`. |
-
diff --git a/tests/admin_checks/tests.py b/tests/admin_checks/tests.py
a
|
b
|
class SystemChecksTestCase(SimpleTestCase):
|
354 | 354 | def test_generic_inline_model_admin_non_generic_model(self): |
355 | 355 | """ |
356 | 356 | A model without a GenericForeignKey raises problems if it's included |
357 | | in an GenericInlineModelAdmin definition. |
| 357 | in a GenericInlineModelAdmin definition. |
358 | 358 | """ |
359 | 359 | class BookInline(GenericStackedInline): |
360 | 360 | model = Book |
-
diff --git a/tests/auth_tests/test_checks.py b/tests/auth_tests/test_checks.py
a
|
b
|
class UserModelChecksTests(SimpleTestCase):
|
58 | 58 | def test_username_non_unique(self): |
59 | 59 | """ |
60 | 60 | A non-unique USERNAME_FIELD should raise an error only if we use the |
61 | | default authentication backend. Otherwise, an warning should be raised. |
| 61 | default authentication backend. Otherwise, a warning should be raised. |
62 | 62 | """ |
63 | 63 | errors = checks.run_checks() |
64 | 64 | self.assertEqual(errors, [ |
-
diff --git a/tests/files/tests.py b/tests/files/tests.py
a
|
b
|
class DimensionClosingBug(unittest.TestCase):
|
244 | 244 | """ |
245 | 245 | # We need to inject a modified open() builtin into the images module |
246 | 246 | # that checks if the file was closed properly if the function is |
247 | | # called with a filename instead of an file object. |
| 247 | # called with a filename instead of a file object. |
248 | 248 | # get_image_dimensions will call our catching_open instead of the |
249 | 249 | # regular builtin one. |
250 | 250 | |
-
diff --git a/tests/m2m_through_regress/models.py b/tests/m2m_through_regress/models.py
a
|
b
|
class Group(models.Model):
|
40 | 40 | return self.name |
41 | 41 | |
42 | 42 | |
43 | | # A set of models that use an non-abstract inherited model as the 'through' model. |
| 43 | # A set of models that use a non-abstract inherited model as the 'through' model. |
44 | 44 | class A(models.Model): |
45 | 45 | a_text = models.CharField(max_length=20) |
46 | 46 | |
-
diff --git a/tests/managers_regress/tests.py b/tests/managers_regress/tests.py
a
|
b
|
class ManagersRegressionTests(TestCase):
|
65 | 65 | AbstractBase3.objects.all() |
66 | 66 | |
67 | 67 | def test_custom_abstract_manager(self): |
68 | | # Accessing the manager on an abstract model with an custom |
| 68 | # Accessing the manager on an abstract model with a custom |
69 | 69 | # manager should raise an attribute error with an appropriate |
70 | 70 | # message. |
71 | 71 | msg = "Manager isn't available; AbstractBase2 is abstract" |
-
diff --git a/tests/many_to_one/tests.py b/tests/many_to_one/tests.py
a
|
b
|
class ManyToOneTests(TestCase):
|
570 | 570 | Third.objects.create(name='Third 1') |
571 | 571 | Third.objects.create(name='Third 2') |
572 | 572 | th = Third(name="testing") |
573 | | # The object isn't saved an thus the relation field is null - we won't even |
| 573 | # The object isn't saved and thus the relation field is null - we won't even |
574 | 574 | # execute a query in this case. |
575 | 575 | with self.assertNumQueries(0): |
576 | 576 | self.assertEqual(th.child_set.count(), 0) |
577 | 577 | th.save() |
578 | | # Now the model is saved, so we will need to execute an query. |
| 578 | # Now the model is saved, so we will need to execute a query. |
579 | 579 | with self.assertNumQueries(1): |
580 | 580 | self.assertEqual(th.child_set.count(), 0) |
581 | 581 | |
… |
… |
class ManyToOneTests(TestCase):
|
591 | 591 | |
592 | 592 | self.assertEqual(public_student.school, public_school) |
593 | 593 | |
594 | | # Make sure the base manager is used so that an student can still access |
| 594 | # Make sure the base manager is used so that a student can still access |
595 | 595 | # its related school even if the default manager doesn't normally |
596 | 596 | # allow it. |
597 | 597 | self.assertEqual(private_student.school, private_school) |
-
diff --git a/tests/migrations/test_autodetector.py b/tests/migrations/test_autodetector.py
a
|
b
|
class AutodetectorTests(TestCase):
|
1146 | 1146 | # a CreateModel operation w/o any definition on the original model |
1147 | 1147 | model_state_not_specified = ModelState("a", "model", [("id", models.AutoField(primary_key=True))]) |
1148 | 1148 | # Explicitly testing for None, since this was the issue in #23452 after |
1149 | | # a AlterFooTogether operation with e.g. () as value |
| 1149 | # an AlterFooTogether operation with e.g. () as value |
1150 | 1150 | model_state_none = ModelState("a", "model", [ |
1151 | 1151 | ("id", models.AutoField(primary_key=True)) |
1152 | 1152 | ], { |
-
diff --git a/tests/migrations/test_commands.py b/tests/migrations/test_commands.py
a
|
b
|
class MigrateTests(MigrationTestBase):
|
155 | 155 | # Fails because "migrations_tribble" does not exist but needs to in |
156 | 156 | # order to make --fake-initial work. |
157 | 157 | call_command("migrate", "migrations", fake_initial=True, verbosity=0) |
158 | | # Fake a apply |
| 158 | # Fake an apply |
159 | 159 | call_command("migrate", "migrations", fake=True, verbosity=0) |
160 | 160 | call_command("migrate", "migrations", fake=True, verbosity=0, database="other") |
161 | 161 | # Unmigrate everything |
-
diff --git a/tests/model_regress/tests.py b/tests/model_regress/tests.py
a
|
b
|
class ModelTests(TestCase):
|
188 | 188 | |
189 | 189 | @skipUnlessDBFeature("supports_timezones") |
190 | 190 | def test_timezones(self): |
191 | | # Saving an updating with timezone-aware datetime Python objects. |
| 191 | # Saving and updating with timezone-aware datetime Python objects. |
192 | 192 | # Regression test for #10443. |
193 | 193 | # The idea is that all these creations and saving should work without |
194 | 194 | # crashing. It's not rocket science. |
-
diff --git a/tests/proxy_models/models.py b/tests/proxy_models/models.py
a
|
b
|
class ManagerMixin(models.Model):
|
69 | 69 | |
70 | 70 | class OtherPerson(Person, ManagerMixin): |
71 | 71 | """ |
72 | | A class with the default manager from Person, plus an secondary manager. |
| 72 | A class with the default manager from Person, plus a secondary manager. |
73 | 73 | """ |
74 | 74 | class Meta: |
75 | 75 | proxy = True |
-
diff --git a/tests/requests/tests.py b/tests/requests/tests.py
a
|
b
|
class RequestsTests(SimpleTestCase):
|
235 | 235 | self.assertEqual(response.cookies['c']['expires'], '') |
236 | 236 | |
237 | 237 | def test_far_expiration(self): |
238 | | "Cookie will expire when an distant expiration time is provided" |
| 238 | "Cookie will expire when a distant expiration time is provided" |
239 | 239 | response = HttpResponse() |
240 | 240 | response.set_cookie('datetime', expires=datetime(2028, 1, 1, 4, 5, 6)) |
241 | 241 | datetime_cookie = response.cookies['datetime'] |
-
diff --git a/tests/staticfiles_tests/project/documents/cached/css/fonts/font.eot b/tests/staticfiles_tests/project/documents/cached/css/fonts/font.eot
a
|
b
|
|
1 | | not really a EOT ;) |
2 | | No newline at end of file |
| 1 | not really an EOT ;) |
| 2 | No newline at end of file |