Django

Code

Changeset 7766

Show
Ignore:
Timestamp:
06/26/08 08:25:59 (2 months ago)
Author:
mtredinnick
Message:

Fixed #7312 -- Fixed handling of custom Q-like objects in QuerySet?.custom_filter().

This is pretty much internal-use-only code, so doesn't affect public API at
all, but it's nice to be able to handle things properly in any case. Patch from
emulbreh.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/db/models/query.py

    r7765 r7766  
    493493        """ 
    494494        if isinstance(filter_obj, Q) or hasattr(filter_obj, 'add_to_query'): 
    495             return self._filter_or_exclude(None, filter_obj) 
     495            clone = self._clone() 
     496            clone.query.add_q(filter_obj) 
     497            return clone 
    496498        else: 
    497499            return self._filter_or_exclude(None, **filter_obj)