MCPcopy Create free account
hub / github.com/django-haystack/django-haystack / handle_save

Method handle_save

haystack/signals.py:39–52  ·  view source on GitHub ↗

Given an individual model instance, determine which backends the update should be sent to & update the object on those backends.

(self, sender, instance, **kwargs)

Source from the content-addressed store, hash-verified

37 pass
38
39 def handle_save(self, sender, instance, **kwargs):
40 """
41 Given an individual model instance, determine which backends the
42 update should be sent to & update the object on those backends.
43 """
44 using_backends = self.connection_router.for_write(instance=instance)
45
46 for using in using_backends:
47 try:
48 index = self.connections[using].get_unified_index().get_index(sender)
49 index.update_object(instance, using=using)
50 except NotHandled:
51 # TODO: Maybe log it or let the exception bubble?
52 pass
53
54 def handle_delete(self, sender, instance, **kwargs):
55 """

Callers

nothing calls this directly

Calls 4

get_unified_indexMethod · 0.80
for_writeMethod · 0.45
get_indexMethod · 0.45
update_objectMethod · 0.45

Tested by

no test coverage detected