Skip to content

Instantly share code, notes, and snippets.

@loic
loic / -
Created April 2, 2015 16:08
/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pkgutil.py:186: ImportWarning: Not importing directory /Users/loic/dev/django/venv/lib/python2.7/site-packages/sphinxcontrib: missing __init__.py
diff --git a/tests/auth_tests/urls_custom_user_admin.py b/tests/auth_tests/urls_custom_user_admin.py
index 552ccf0..f719837 100644
--- a/tests/auth_tests/urls_custom_user_admin.py
+++ b/tests/auth_tests/urls_custom_user_admin.py
@@ -6,7 +6,12 @@ from django.contrib.auth.urls import urlpatterns
site = admin.AdminSite(name='custom_user_admin')
-site.register(get_user_model(), UserAdmin)
+
diff --git a/django/db/models/query.py b/django/db/models/query.py
index b2d210f..0c88b50 100644
--- a/django/db/models/query.py
+++ b/django/db/models/query.py
@@ -165,7 +165,19 @@ class QuerySet(object):
Represents a lazy database lookup for a set of objects.
"""
- def __init__(self, model=None, query=None, using=None, hints=None):
+ def __new__(cls, *args, **kwargs):
diff --git a/django/db/models/query.py b/django/db/models/query.py
index ef0c2db..20edcd6 100644
--- a/django/db/models/query.py
+++ b/django/db/models/query.py
@@ -886,16 +886,14 @@ class QuerySet(object):
if names is None:
names = {f.name for f in self.model._meta.get_fields()}
+ added_aggregates = False
for alias, annotation in annotations.items():
commit 82b4162aebdf319bcc39af342ebee94be8c8eebd
Author: Loic Bistuer <loic.bistuer@gmail.com>
Date: Wed Jan 28 03:12:24 2015 +0700
WIP
diff --git a/django/db/models/fields/related.py b/django/db/models/fields/related.py
index d917b01..d5bc763 100644
--- a/django/db/models/fields/related.py
+++ b/django/db/models/fields/related.py
commit bc5eac933cdbe129625c6fc5054859b33f77ab88
Author: Loic Bistuer <loic.bistuer@gmail.com>
Date: Wed Jan 28 02:30:33 2015 +0700
WIP
diff --git a/django/db/models/fields/related.py b/django/db/models/fields/related.py
index d917b01..d5bc763 100644
--- a/django/db/models/fields/related.py
+++ b/django/db/models/fields/related.py
diff --git a/docs/ref/models/relations.txt b/docs/ref/models/relations.txt
index eb5c815..1faca0b 100644
--- a/docs/ref/models/relations.txt
+++ b/docs/ref/models/relations.txt
@@ -150,6 +150,10 @@ Related objects reference
If ``clear=True``, the ``clear()`` method is called instead and the
whole set is added at once.
+ Note that ``set()`` being a compound operation it is subjected to race
+ conditions. For instance new objects may be added to the database in
commit ac7828487fbb574e098bdf0cb9f727b05f35d240
Author: Loic Bistuer <loic.bistuer@gmail.com>
Date: Wed Jan 21 13:14:40 2015 +0700
Cleaned up QuerySet cloning.
diff --git a/django/db/models/query.py b/django/db/models/query.py
index 6774fee..44e8fff 100644
--- a/django/db/models/query.py
+++ b/django/db/models/query.py
ReverseSingleRelatedObjectDescriptor = forward side of FK and O2O
ReverseManyRelatedObjectsDescriptor = forward side of M2M
SingleRelatedObjectDescriptor = reverse side of O2O
ForeignRelatedObjectsDescriptor = reverse side of FK
ManyRelatedObjectsDescriptor = reverse side of M2M
@loic
loic / -
Created December 3, 2014 08:45
# This is an example test settings file for use with the Django test suite.
#
# The 'sqlite3' backend requires only the ENGINE setting (an in-
# memory database will be used). All other backends will require a
# NAME and potentially authentication information. See the
# following section in the docs for more information:
#
# https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/
#
# The different databases that Django supports behave differently in certain