Skip to content

Instantly share code, notes, and snippets.

@loic
loic / foo.diff
Last active December 29, 2015 18:09
diff --git a/django/core/exceptions.py b/django/core/exceptions.py
index 62c4d0b..418eaab 100644
--- a/django/core/exceptions.py
+++ b/django/core/exceptions.py
@@ -3,6 +3,7 @@ Global Django exception and warning classes.
"""
from functools import reduce
import operator
+import copy
diff --git a/django/utils/autoreload.py b/django/utils/autoreload.py
index 3c71fa2..063b9f2 100644
--- a/django/utils/autoreload.py
+++ b/django/utils/autoreload.py
@@ -185,6 +185,7 @@ def kqueue_code_changed():
kqueue.control([make_kevent(watcher)], 0)
def update_watch(sender=None, **kwargs):
+ print("update_watch")
watcher.write(b'.')
14:30 loic84: ping akaariai_
14:32 akaariai_: loic84: hi
14:32 loic84: akaariai_: hey, just spotted your comment on #21410.
14:32 ticketbot: https://code.djangoproject.com/ticket/21410
14:34 bouke has joined (~bouke@5ED78770.cm-7-8c.dynamic.ziggo.nl)
14:34 loic84: can you think of way to express the multicolumn lookups with an example? I'd like to add a test case for it.
14:34 bouke: mYk: there appears to be a problem with the autoreloader on kqueue and PY3 -> https://github.com/django/django/blob/master/django/utils/autoreload.py#L173 bufsize is not a valid param on PY3
14:36 akaariai_: loic84: hmmh, not sure how to do that. Actually, if you give fk__in=instances in 1.6 it might be that multicolumn lookups are never involved
14:36 akaariai_: unless you have heavily modified FK field written in your project
14:37 bouke: mYk: refs #21420
diff --git a/django/db/migrations/autodetector.py b/django/db/migrations/autodetector.py
index 86ddd3c..78c9770 100644
--- a/django/db/migrations/autodetector.py
+++ b/django/db/migrations/autodetector.py
@@ -67,7 +67,7 @@ class MigrationAutodetector(object):
model_state = self.to_state.models[app_label, model_name]
# Are there any relationships out from this model? if so, punt it to the next phase.
related_fields = []
- for field in new_app_cache.get_model(app_label, model_name)._meta.fields:
+ for field in new_app_cache.get_model(app_label, model_name)._meta.local_fields:
@loic
loic / migration.py
Last active December 31, 2015 09:59
# encoding: utf8
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [('workflows', '0003_auto_20131212_2349')]
operations = [
migrations.AddField(
@loic
loic / foo.diff
Last active December 31, 2015 10:39
diff --git a/tests/migrations/test_bug/0001_initial.py b/tests/migrations/test_bug/0001_initial.py
new file mode 100644
index 0000000..b07efdf
--- /dev/null
+++ b/tests/migrations/test_bug/0001_initial.py
@@ -0,0 +1,13 @@
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
diff --git a/django/contrib/auth/management/__init__.py b/django/contrib/auth/management/__init__.py
index 5f24bf0..d060f29 100644
--- a/django/contrib/auth/management/__init__.py
+++ b/django/contrib/auth/management/__init__.py
@@ -89,6 +89,8 @@ def create_permissions(app, created_models, verbosity, db=DEFAULT_DB_ALIAS, **kw
# Find all the Permissions that have a content_type for a model we're
# looking for. We don't need to check for codenames since we already have
# a list of the ones we're going to create.
+ print ctypes
+ print len(ctypes)
diff --git a/django/contrib/auth/management/__init__.py b/django/contrib/auth/management/__init__.py
index 5f24bf0..8cc14894 100644
--- a/django/contrib/auth/management/__init__.py
+++ b/django/contrib/auth/management/__init__.py
@@ -89,6 +89,7 @@ def create_permissions(app, created_models, verbosity, db=DEFAULT_DB_ALIAS, **kw
# Find all the Permissions that have a content_type for a model we're
# looking for. We don't need to check for codenames since we already have
# a list of the ones we're going to create.
+ print len(ctypes)
all_perms = set(auth_app.Permission.objects.using(db).filter(
diff --git a/django/forms/utils.py b/django/forms/utils.py
index 3582384..4d44d28 100644
--- a/django/forms/utils.py
+++ b/django/forms/utils.py
@@ -127,6 +127,10 @@ class ErrorList(UserList):
return list(error)[0]
return force_text(error)
+ @classmethod
+ def __instancecheck__(cls, instance):
diff --git a/django/contrib/staticfiles/finders.py b/django/contrib/staticfiles/finders.py
index eede6fb..eed88a0 100644
--- a/django/contrib/staticfiles/finders.py
+++ b/django/contrib/staticfiles/finders.py
@@ -57,7 +57,7 @@ class FileSystemFinder(BaseFinder):
prefix, root = root
else:
prefix = ''
- if os.path.abspath(settings.STATIC_ROOT) == os.path.abspath(root):
+ if settings.STATIC_ROOT and os.path.abspath(settings.STATIC_ROOT) == os.path.abspath(root):