3fca95e1ad
Instead of loading all QuerySet results in memory, count the number of entries. This adds an extra query when list() or tuple() is called on the choices (because both call __len__() then __iter__()) but uses less memory since the QuerySet results won't be cached. In most cases, the choices will only be iterated on, meaning that __len__() won't be called and only one query will be executed. |
||
---|---|---|
.. | ||
__init__.py | ||
models.py | ||
test.png | ||
test2.png | ||
test_modelchoicefield.py | ||
test_uuid.py | ||
tests.py |