Skip to content

Instantly share code, notes, and snippets.

diff --git a/tests/template_tests/templates/recursive_include.html b/tests/template_tests/templates/recursive_include.html
new file mode 100644
index 0000000..fdc7702
--- /dev/null
+++ b/tests/template_tests/templates/recursive_include.html
@@ -0,0 +1,7 @@
+"Recursion!"
+{% for comment in comments %}
+ {{ comment.comment }}
+ {% if comment.children %}
@loic
loic / -
Created August 21, 2013 07:13
diff --git a/django/db/models/query.py b/django/db/models/query.py
index 836d394..3b60aa6 100644
--- a/django/db/models/query.py
+++ b/django/db/models/query.py
@@ -48,6 +48,12 @@ class QuerySet(object):
"""
def __init__(self, model=None, query=None, using=None):
+ if hasattr(model, 'all'):
+ queryset = model.all()
#!/bin/sh
function list_contributors {
git log | grep "Author:" | sed "s/ //" | sed "s/ <.*//" | sort | uniq -c | sort
}
function total_contributors {
list_contributors | wc -l | sed 's/ *//'
}
@loic
loic / patch.diff
Last active December 20, 2015 23:19
$ python3 ./tests/runtests.py model_inheritance_regress
Creating test database for alias 'default'...
Creating test database for alias 'other'...
E.....x.F............
======================================================================
ERROR: test_abstract_base_class_m2m_relation_inheritance (model_inheritance_regress.tests.ModelInheritanceTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/loic/Dev/django/tests/model_inheritance_regress/tests.py", line 386, in test_abstract_base_class_m2m_relation_inheritance
messy_parent = messy.bachelorparty_ptr
diff --git a/tests/view_tests/tests/test_i18n.py b/tests/view_tests/tests/test_i18n.py
index 7a7e615..cfee4f5 100644
--- a/tests/view_tests/tests/test_i18n.py
+++ b/tests/view_tests/tests/test_i18n.py
@@ -198,26 +198,22 @@ class JavascriptI18nTests(LiveServerTestCase):
@override_settings(LANGUAGE_CODE='de')
def test_javascript_gettext(self):
- extended_apps = list(settings.INSTALLED_APPS) + ['view_tests']
- with self.settings(INSTALLED_APPS=extended_apps):
diff --git a/django/db/models/base.py b/django/db/models/base.py
index 01ba559..6496aaa 100644
--- a/django/db/models/base.py
+++ b/django/db/models/base.py
@@ -185,8 +185,10 @@ class ModelBase(type):
new_class._meta.concrete_model = new_class
# Do the appropriate setup for any model parents.
- o2o_map = dict([(f.rel.to, f) for f in new_class._meta.local_fields
- if isinstance(f, OneToOneField)])
diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py
index fb4cbbb..029b0ee 100644
--- a/django/db/models/fields/__init__.py
+++ b/django/db/models/fields/__init__.py
@@ -677,8 +677,9 @@ class AutoField(Field):
}
def __init__(self, *args, **kwargs):
- assert kwargs.get('primary_key', False) is True, \
- "%ss must have primary_key=True." % self.__class__.__name__
@loic
loic / gist:6158578
Last active December 20, 2015 15:59
diff --git a/tests/model_forms/models.py b/tests/model_forms/models.py
index a4cf947..17aec29 100644
--- a/tests/model_forms/models.py
+++ b/tests/model_forms/models.py
@@ -12,7 +12,7 @@ import os
import tempfile
from django.core import validators
-from django.core.exceptions import ImproperlyConfigured
+from django.core.exceptions import ImproperlyConfigured, ValidationError
diff --git a/docs/internals/deprecation.txt b/docs/internals/deprecation.txt
index 53eb8a3..c78fc4a 100644
--- a/docs/internals/deprecation.txt
+++ b/docs/internals/deprecation.txt
@@ -423,8 +423,8 @@ these changes.
* FastCGI support via the ``runfcgi`` management command will be
removed. Please deploy your project using WSGI.
-* django.utils.datastructures.SortedDict will be removed. Use the built in
- collections.OrderedDict instead.
diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py
index 0b941df..39700dd 100644
--- a/django/contrib/admin/options.py
+++ b/django/contrib/admin/options.py
@@ -1,3 +1,4 @@
+from collections import OrderedDict
import copy
import operator
from functools import partial, reduce, update_wrapper
@@ -29,7 +30,6 @@ from django.http.response import HttpResponseBase