From 58bf60ec3d8ac6ae542b0f70dcafcb28ec777682 Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Thu, 2 Feb 2006 04:46:56 +0000 Subject: [PATCH] magic-removal: Fixed #1301 -- Fixed AttributeError when QuerySet.dates() is filtered. Thanks, Esaj git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2223 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/db/models/query.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/django/db/models/query.py b/django/db/models/query.py index ea05043a84..6aee7e52be 100644 --- a/django/db/models/query.py +++ b/django/db/models/query.py @@ -415,6 +415,11 @@ class ValuesQuerySet(QuerySet): for row in rows: yield dict(zip(field_names, row)) + def _clone(self, klass=None, **kwargs): + c = super(ValuesQuerySet, self)._clone(klass, **kwargs) + c._fields = self._fields[:] + return c + class DateQuerySet(QuerySet): def iterator(self): from django.db.backends.util import typecast_timestamp @@ -433,6 +438,13 @@ class DateQuerySet(QuerySet): # objects -- MySQL returns the values as strings, instead. return [typecast_timestamp(str(row[0])) for row in cursor.fetchall()] + def _clone(self, klass=None, **kwargs): + c = super(DateQuerySet, self)._clone(klass, **kwargs) + c._field = self._field + c._kind = self._kind + c._order = self._order + return c + class QOperator: "Base class for QAnd and QOr" def __init__(self, *args):