﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
16898	Throwing an exception out of a custom field (or any QuerySet._results_iter callable) results in a bad _results_cache	Jeremy Dunck	nobody	"Using a custom field which breaks:
{{{
class BrokenField(DateTimeField):
    __metaclass__ = SubfieldBase

    def to_python(self, value):
        raise TypeError(""Nope."")
}}}

Assume some rows exist.

If you then create AModel using that field:

{{{
class AModel(Model):
   f = BrokenField(null=True)
}}}

And you then try to query on it:
{{{
>>> qs = AModel.objects.all()
>>> qs
[]

>>> qs._result_cache is None
True
}}}
You get an empty (or truncated) results list.

I think the underlying exception should instead be raised.  If it only breaks sometimes, the results will be shorter, a very hard-to-find bug."	Bug	closed	Database layer (models, ORM)	1.3	Normal	worksforme			Accepted	0	0	0	0	0	0
