标签: python-2.7 django-1.5
在循环中使用过滤器查询,这需要大量时间才能执行。给我更好的解决方案来克服加载缓慢的问题
for object in objects: object_id = object.get('id') result = model_query_set.filter(store=object_id) lost=result.filter(status='lost').count() won = result.filter(status='won').count()