parent
f3d265bbe0
commit
99f923e27f
@ -5,6 +5,7 @@ Changelog
|
|||||||
Changes in dev
|
Changes in dev
|
||||||
==============
|
==============
|
||||||
|
|
||||||
|
- Fixed queryet __repr__ mid iteration
|
||||||
- Added hint() support, so cantell Mongo the proper index to use for the query
|
- Added hint() support, so cantell Mongo the proper index to use for the query
|
||||||
- Fixed issue with inconsitent setting of _cls breaking inherited referencing
|
- Fixed issue with inconsitent setting of _cls breaking inherited referencing
|
||||||
- Added help_text and verbose_name to fields to help with some form libs
|
- Added help_text and verbose_name to fields to help with some form libs
|
||||||
|
@ -1524,7 +1524,10 @@ class QuerySet(object):
|
|||||||
limit = REPR_OUTPUT_SIZE + 1
|
limit = REPR_OUTPUT_SIZE + 1
|
||||||
if self._limit is not None and self._limit < limit:
|
if self._limit is not None and self._limit < limit:
|
||||||
limit = self._limit
|
limit = self._limit
|
||||||
data = list(self[self._skip:limit])
|
try:
|
||||||
|
data = list(self[self._skip:limit])
|
||||||
|
except pymongo.errors.InvalidOperation:
|
||||||
|
return ".. queryset mid-iteration .."
|
||||||
if len(data) > REPR_OUTPUT_SIZE:
|
if len(data) > REPR_OUTPUT_SIZE:
|
||||||
data[-1] = "...(remaining elements truncated)..."
|
data[-1] = "...(remaining elements truncated)..."
|
||||||
return repr(data)
|
return repr(data)
|
||||||
|
@ -463,6 +463,18 @@ class QuerySetTest(unittest.TestCase):
|
|||||||
|
|
||||||
self.assertEqual(people1, people2)
|
self.assertEqual(people1, people2)
|
||||||
|
|
||||||
|
def test_repr_iteration(self):
|
||||||
|
"""Ensure that QuerySet __repr__ can handle loops
|
||||||
|
"""
|
||||||
|
self.Person(name='Person 1').save()
|
||||||
|
self.Person(name='Person 2').save()
|
||||||
|
|
||||||
|
queryset = self.Person.objects
|
||||||
|
self.assertEquals('[<Person: Person object>, <Person: Person object>]', repr(queryset))
|
||||||
|
for person in queryset:
|
||||||
|
self.assertEquals('.. queryset mid-iteration ..', repr(queryset))
|
||||||
|
|
||||||
|
|
||||||
def test_regex_query_shortcuts(self):
|
def test_regex_query_shortcuts(self):
|
||||||
"""Ensure that contains, startswith, endswith, etc work.
|
"""Ensure that contains, startswith, endswith, etc work.
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user