Commit Graph

7 Commits

Author SHA1 Message Date
Anssi Kääriäinen b6c356b7bb Fixed #17485 -- Made defer work with select_related
This commit tackles a couple of issues. First, in certain cases there
were some mixups if field.attname or field.name should be deferred.
Field.attname is now always used.

Another issue tackled is a case where field is both deferred by
.only(), and selected by select_related. This case is now an error.

A lot of thanks to koniiiik (Michal Petrucha) for the patch, and
to Andrei Antoukh for review.
2012-06-26 18:08:42 +03:00
Anssi Kääriäinen a8a81aae20 Fixed #18343 -- Cleaned up deferred model implementation
Generic cleanup and dead code removal in deferred model field loading
and model.__reduce__().

Also fixed an issue where if an inherited model with a parent field
chain parent_ptr_id -> id would be deferred loaded, then accessing
the id field caused caused a database query, even if the id field's
value is already loaded in the parent_ptr_id field.
2012-05-27 18:11:13 +03:00
Karen Tracey d174216587 Refs #17876: enhanced new test to actually test underlying function, not just ensure trying to use it does not raise an exception. Thanks Przemek Lewandowski.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17695 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-03-13 01:01:22 +00:00
Karen Tracey 9d98b9eb4b Fix #17876: Corrected an exception (regression) raised where select_realted and only is used on a proxy model. Thanks milosu and charettes.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17692 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-03-12 22:33:18 +00:00
Alex Gaynor d5a45d79fe Convert all modeltests to use absolute imports, rather than relative ones.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16975 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-10-13 18:04:12 +00:00
Malcolm Tredinnick 7182cd2284 Allow "pk" as a field alias in QuerySet.only() calls.
Thanks to GDorn for the patch. Fixed #15494.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16668 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-08-23 06:29:01 +00:00
Russell Keith-Magee eb8b5dc2d4 Migrated defer doctests. Thanks to Alex Gaynor.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13777 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-09-12 20:03:20 +00:00