Remove unused code
This commit is contained in:
parent
36ab6d599f
commit
0486af4bba
1 changed files with 0 additions and 22 deletions
|
@ -1,22 +0,0 @@
|
|||
from django.db import models
|
||||
from django.db.models.query import QuerySet
|
||||
|
||||
|
||||
class CachingM2MQuerySet(QuerySet):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(CachingM2MQuerySet, self).__init__(*args, **kwargs)
|
||||
self.cached_m2m_field = kwargs["m2m_field"]
|
||||
|
||||
def iterator(self):
|
||||
parent_iter = super(CachingM2MQuerySet, self).iterator()
|
||||
|
||||
for obj in parent_iter:
|
||||
if obj.id in cached_objects:
|
||||
setattr(obj, "_cached_m2m_%s" % self.cached_m2m_field)
|
||||
yield obj
|
||||
|
||||
|
||||
class ProposalManager(models.Manager):
|
||||
def cache_m2m(self, m2m_field):
|
||||
return CachingM2MQuerySet(self.model, using=self._db, m2m_field=m2m_field)
|
Loading…
Reference in a new issue