Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

related_models update index before delete #420

Open
ramendoza opened this issue Sep 4, 2022 · 2 comments
Open

related_models update index before delete #420

ramendoza opened this issue Sep 4, 2022 · 2 comments

Comments

@ramendoza
Copy link

ramendoza commented Sep 4, 2022

I have a document

class DocDocument(Document):
    class Django:
        model = Model1
        related_models = [Model2]

def get_instances_from_related(self, related_instance):
    if isinstance(related_instance, Model2):
        return related_instance.model1

When I delete Model2, it updates the document but Model2 still indexes me because it calls the function in a pre_delete and not in a post_delete

@millerf
Copy link

millerf commented Jun 17, 2023

I have exactly the same issue... I am not sure of this is intended. However I end up with a desync between my models and the document...

@mike-ivs
Copy link

Likewise, just encountered this behaviour

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants