def save(self, force_insert=False, force_update=False): if self.pk: raise self.ImmutableError, ( '%s objects are immutable once created' % self.__class__.__name__) super(DocIndexMapping, self).save( force_insert=force_insert, force_update=force_update) # Now, index existing fields. cls = self.doc_type.content_type.model_class() for obj in cls.objects.dtype(**{self.dfield: self.doc_type}): self.maybe_index_doc(obj, new_mapping=True) # Finally make sure we get the right set of hooks after # creating the mapping. signals.maybe_connect(cls)
def class_prepared_handler(sender, **kwargs): maybe_connect(sender)