Ticket #4399: 5358_added_nonzero_for_queryset.diff
File 5358_added_nonzero_for_queryset.diff, 593 bytes (added by , 17 years ago) |
---|
-
django/db/models/query.py
164 164 combined._filters = self._filters | other._filters 165 165 return combined 166 166 167 def __nonzero__(self): 168 """ 169 Returns True if an element exists. 170 """ 171 return len(self.values(self.model._meta.pk.name)[:1]) > 0 172 167 173 #################################### 168 174 # METHODS THAT DO DATABASE QUERIES # 169 175 ####################################