This file contains 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_add (many_to_many.tests.ManyToManyTests):sqlite:556fa4bbba | |
+++ test_add (many_to_many.tests.ManyToManyTests):sqlite:bbf141bcdc | |
@@ -41,7 +41,7 @@ | |
INNER JOIN "many_to_many_article_publications" ON ("many_to_many_publication"."id" = "many_to_many_article_publications"."publication_id") | |
WHERE "many_to_many_article_publications"."article_id" = %s | |
ORDER BY "many_to_many_publication"."title" ASC | |
-ROLLBACK TO SAVEPOINT "s4705965568_x3" | |
+ROLLBACK TO SAVEPOINT "s4422178304_x3" | |
INSERT INTO "many_to_many_publication" ("title") | |
VALUES (%s) |
This file contains 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
import argparse | |
import difflib | |
import os | |
import sys | |
from itertools import chain | |
import yaml | |
file_name_format = "{sha}:{vendor}.yml" |
This file contains 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 PrefetchedManagerGenericForeignKey(GenericForeignKey): | |
def __init__(self, manager_name, *args, **kwargs): | |
self.manager_name = manager_name | |
super(PrefetchedManagerGenericForeignKey, self).__init__(*args, **kwargs) | |
def get_content_type_manager(self, content_type): | |
model_class = content_type.model_class() | |
return getattr(model_class, self.manager_name, model_class._base_manager) | |
# This is mostly a copy-paste of the GenericForeignKey implementation |
This file contains 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
from __future__ import unicode_literals | |
import re | |
import sys | |
from importlib import import_module | |
class _AliasLoader(object): | |
def __init__(self, alias, aliased): | |
self.alias = alias |
This file contains 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 ImportForeignModel(Operation): | |
"""Import a model from a foreign app to this one.""" | |
def __init__(self, app_label, model_name): | |
self.app_label = app_label | |
self.model_name = model_name.lower() | |
def state_forwards(self, app_label, state): | |
imported_model_state = state.models[self.app_label, self.model_name].clone() | |
# Change the app label. |
This file contains 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
#!/usr/bin/env python | |
""" | |
This script assumes you have both flake8 and flake8-commas packages | |
installed in the Python environment you use to run this script. | |
""" | |
import subprocess | |
import sys | |
from collections import defaultdict |
This file contains 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/test_client_regress/tests.py b/tests/test_client_regress/tests.py | |
index b8d7c99..8c67a18 100644 | |
--- a/tests/test_client_regress/tests.py | |
+++ b/tests/test_client_regress/tests.py | |
@@ -467,6 +467,10 @@ class AssertRedirectsTests(SimpleTestCase): | |
self.assertEqual(response.request.get('wsgi.url_scheme'), 'https') | |
self.assertEqual(response.request.get('SERVER_NAME'), 'otherserver') | |
self.assertEqual(response.request.get('SERVER_PORT'), '8443') | |
+ response = self.client.get('/redirect_other_host/', follow=False) | |
+ self.assertRedirects( |
This file contains 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
# Add the common tests module as an application to allow its models | |
# table to be created even if they are not part of the common migations. | |
app_config = AppConfig.create(__package__) | |
app_config.label = 'common_tests' | |
app_config.import_models(apps.all_models[app_config.label]) | |
apps.app_configs[app_config.label] = app_config | |
apps.clear_cache() |
This file contains 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
from django.db import router | |
from django.db.models import deletion | |
def ALLOW_MIGRATE_CASCADE(collector, field, sub_objs, using): | |
opts = sub_objs[0]._meta | |
if router.allow_migrate(using, opts.app_label, opts.model_name): | |
deletion.CASCADE(collector, field, sub_objs, using) |
This file contains 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
import collections | |
import gc | |
import weakref | |
def create_reference(): | |
class A(object): | |
pass | |
class B(A): | |
parents = collections.OrderedDict([ |
NewerOlder