1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

[soc2009/multidb] Made instances sticky to the database that created them.

This involves:
 * Adding a _state attribute to instances to track instance state
 * Making db a state attribute, and making the db a public attribute on querysets.

Patch from Russell Keith-Magee.

git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/multidb@11769 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Alex Gaynor
2009-11-23 16:43:54 +00:00
parent cec677a782
commit da909ae3a0
12 changed files with 280 additions and 135 deletions

View File

@@ -315,7 +315,7 @@ DoesNotExist: ArticleWithAuthor matching query does not exist.
# Regression test for #9390. This necessarily pokes at the SQL string for the
# query, since the duplicate problems are only apparent at that late stage.
>>> qs = ArticleWithAuthor.objects.order_by('pub_date', 'pk')
>>> sql = qs.query.get_compiler(qs._using).as_sql()[0]
>>> sql = qs.query.get_compiler(qs.db).as_sql()[0]
>>> fragment = sql[sql.find('ORDER BY'):]
>>> pos = fragment.find('pub_date')
>>> fragment.find('pub_date', pos + 1) == -1