Commits

Patrick Jenkins committed 318cbcc

A django.db.models.options.Options object is not guranteed to have a _related_objects_cache. Johnny-cache does not check to see if this is the case. We need to check to see if _related_objects_cache is an attribute of the django.db.models.options.Options we're examining and if not we need to call _fill_related_objects_cache().

Comments (0)

Files changed (1)

             tables.add(instance._meta.db_table)
             self.keyhandler.invalidate_table(instance._meta.db_table)
 
+            try:
+                 instance._meta._related_objects_cache
+            except AttributeError:
+                 instance._meta._fill_related_objects_cache()
+
             for obj in instance._meta._related_objects_cache.keys():
                 obj_table = obj.model._meta.db_table
                 if obj_table not in tables: