Resolved a UNIQUE id error when re-saving a typeclassed object. This was due to an idmapper hack which I *think* is not needed anymore, but might need to look at this in the future to see if the related lookup is actually using the cache or not.

This commit is contained in:
Griatch 2014-12-21 19:57:01 +01:00
parent 3b704d37dc
commit b244d70e16

View file

@ -15,11 +15,15 @@ class SharedMemoryManager(Manager):
# rel_obj = rel_mgr.using(db).get(**params) # rel_obj = rel_mgr.using(db).get(**params)
# We need to handle using, or the get method will be called on a vanilla # We need to handle using, or the get method will be called on a vanilla
# queryset, and we won't get a change to use the cache. # queryset, and we won't get a change to use the cache.
def using(self, alias):
if alias == router.db_for_read(self.model): #TODO - removing this for django1.7 - the call mentioned above doesn't happen
return self # anymore but is the cache still used? /Griatch
else: #def using(self, alias):
return super(SharedMemoryManager, self).using(alias) # if alias == router.db_for_read(self.model):
# # this should return a queryset!
# return self
# else:
# return super(SharedMemoryManager, self).using(alias)
# TODO: improve on this implementation # TODO: improve on this implementation
# We need a way to handle reverse lookups so that this model can # We need a way to handle reverse lookups so that this model can