diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2009-03-19 09:06:04 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2009-03-19 09:06:04 +0000 |
| commit | 29050ef999e1931efb6c62471c7e07d2ea5e96ea (patch) | |
| tree | 68721a86a15b9d56487c1603097ec281691f2083 /tests/regressiontests | |
| parent | 96d5d434fac940aff854c939bef74394fe2c586e (diff) | |
Fixed #5420 -- Added support for delayed loading of model fields.
In extreme cases, some fields are expensive to load from the database
(e.g. GIS fields requiring conversion, or large text fields). This
commit adds defer() and only() methods to querysets that allow the
caller to specify which fields should not be loaded unless they are
accessed.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10090 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests')
| -rw-r--r-- | tests/regressiontests/queries/models.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/regressiontests/queries/models.py b/tests/regressiontests/queries/models.py index ccf06be5f3..939fc0e86f 100644 --- a/tests/regressiontests/queries/models.py +++ b/tests/regressiontests/queries/models.py @@ -890,6 +890,12 @@ unpickling. >>> query2.as_sql()[0] == query True +Check pickling of deferred-loading querysets +>>> qs = Item.objects.defer('name', 'creator') +>>> q2 = pickle.loads(pickle.dumps(qs)) +>>> list(qs) == list(q2) +True + Bug #7277 >>> n1.annotation_set.filter(Q(tag=t5) | Q(tag__children=t5) | Q(tag__children__children=t5)) [<Annotation: a1>] |
