You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@receiver(post_save)
def update_document(sender, **kwargs):
"""Update document on added/changed records.
Update Book document index if related `books.Publisher` (`publisher`),
`books.Author` (`authors`), `books.Tag` (`tags`) fields have been updated
in the database.
"""
app_label = sender._meta.app_label
model_name = sender._meta.model_name
instance = kwargs['instance']
if app_label == 'book':
# If it is `books.Publisher` that is being updated.
if model_name == 'publisher':
instances = instance.books.all()
for _instance in instances:
registry.update(_instance)
i.e for my use case if I have instead of book, address then
instances = instance.addresses.all()
But where is the plural addresses defined? If defined here: books.Author first parameter:
Questions
Can someone please explain where we get the plural for book, books? From the docs:
https://django-elasticsearch-dsl-drf.readthedocs.io/en/latest/quick_start.html#full-database-sync:
search_indexes/signals.py
i.e for my use case if I have instead of book, address then
instances = instance.addresses.all()
But where is the plural addresses defined? If defined here: books.Author first parameter:
then if based on first or second parameter ? Since using Djongo.models there is no related_name key
The text was updated successfully, but these errors were encountered: