I'm using a proxy model, so that I can use Elastic search on the same model
using two different serialisers.
However, the new_index_elastic function never runs (ie I never see the
print, and my NewModel never gets indexed).
How would I do this?
class Item(EsIndexable, models.Model):
title = models.CharField( blank=True)
tag = models.ManyToManyField('Tag', blank=True)
class Elasticsearch(EsIndexable.Elasticsearch):
serializer_class = ItemEsSerializer
fields = ['title', 'tag']
@receiver(post_save, sender= Item)def index_elastic(instance, **kwargs):
instance.es.do_index()
class Newmodel(Item):
class Meta:
proxy = True
class Elasticsearch(EsIndexable.Elasticsearch):
serializer_class = NewModelEsSerializer
fields = ['title', 'tag']
@receiver(post_save, sender= Newmodel)def new_index_elastic(instance, **kwargs):
print('Index proxy')
instance.es.do_index()
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/967390f9-5c81-4f0d-8cb5-9c24a9f88466%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.