This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
index 1bb64c9..253f382 100644 | |
--- a/tests/prefetch_related/tests.py | |
+++ b/tests/prefetch_related/tests.py | |
@@ -4,8 +4,10 @@ from django.core.exceptions import ObjectDoesNotExist | |
from django.contrib.contenttypes.models import ContentType | |
from django.db import connection | |
from django.db.models import Prefetch | |
+from django.db.models.query import get_prefetcher | |
from django.test import TestCase, override_settings | |
from django.utils import six |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/tests/migrations/test_writer.py b/tests/migrations/test_writer.py | |
index 8bdce5d..2c8ab99 100644 | |
--- a/tests/migrations/test_writer.py | |
+++ b/tests/migrations/test_writer.py | |
@@ -59,7 +59,11 @@ class WriterTests(TestCase): | |
self.assertSerializedEqual(1) | |
self.assertSerializedEqual(None) | |
self.assertSerializedEqual(b"foobar") | |
+ string, imports = MigrationWriter.serialize(b"foobar") | |
+ self.assertEqual(string, "b'foobar'") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo(models.Model): | |
pass | |
class Bar(models.Model): | |
foo = models.ForeignKey(Foo, blank=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/django/contrib/contenttypes/fields.py b/django/contrib/contenttypes/fields.py | |
index 39fbe0e..dab3d69 100644 | |
--- a/django/contrib/contenttypes/fields.py | |
+++ b/django/contrib/contenttypes/fields.py | |
@@ -30,13 +30,11 @@ class GenericForeignKey(six.with_metaclass(RenameGenericForeignKeyMethods)): | |
fields. | |
""" | |
- def __init__(self, ct_field="content_type", fk_field="object_id", for_concrete_model=True, | |
- related_name=None): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/django/db/migrations/state.py b/django/db/migrations/state.py | |
index 79a4411..ad9fb07 100644 | |
--- a/django/db/migrations/state.py | |
+++ b/django/db/migrations/state.py | |
@@ -1,3 +1,5 @@ | |
+from collections import OrderedDict | |
+ | |
from django.apps import AppConfig | |
from django.apps.registry import Apps | |
from django.db import models |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
loic84: FunkyBob: so you could customize the QS? like limit the number of related objects pulled from the db, or encapsulate more logic in QS methods. | |
13:49 loic84: say you want Blog.objects.get_queryset() to automatically perform a bunch of select_related/prefetch_related | |
13:50 loic84: when you do Article.objects.select_related('blog'), these are ignored. | |
13:51 loic84: so then you are left with 2 options, either you use prefetch_related('block') rather than select_related so you can use your custom manager, or you duplicate all the logic in the original select_related(). | |
13:52 loic84: also you may want to select_related('blog') but defer() a bunch of fields |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def __getitem__(self, key): | |
+ if hasattr(self, key): | |
+ return getattr(self, key) | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/django/contrib/auth/models.py b/django/contrib/auth/models.py | |
index 5b89fe8..e8c796a 100644 | |
--- a/django/contrib/auth/models.py | |
+++ b/django/contrib/auth/models.py | |
@@ -13,7 +13,6 @@ from django.contrib import auth | |
from django.contrib.auth.hashers import ( | |
check_password, make_password, is_password_usable) | |
from django.contrib.auth.signals import user_logged_in | |
-from django.contrib.contenttypes.models import ContentType | |
from django.utils.encoding import python_2_unicode_compatible |