def post_delete(self, sender, document, **kwargs): """ Post delete hook handler - De-index group from elasticsearch """ es_document_deindex.delay(document)
def post_delete(self, sender, document, **kwargs): """ Post save hook handler - De-index item from elasticsearch """ # De-index item from elasticsearch es_document_deindex.delay(document)
def post_delete(self, sender, document, **kwargs): """ Post delete hook handler - Deletes related photo, if exists - De-index entity from elasticsearch """ # Deletes related photo, if exists if document.photo: document.photo.delete() # De-index entity from elasticsearch es_document_deindex.delay(document)
def post_delete(self, sender, document, **kwargs): """ Post delete hook handler - Deletes related attachments, if exists - De-index invoice based document from elasticsearch - Removes timeline and notification entries """ # Deletes related attachments, if exists for attachment in document.attachments: attachment.delete() # De-index invoice based document from elasticsearch es_document_deindex.delay(document) # Removes timeline and notification entries invoicebase_deleted_task.delay(document)
def post_delete(self, sender, document, **kwargs): """ Post delete hook handler - Removes the django user from the django group - De-index user from elasticsearch """ from django.contrib.auth.models import Group UserModel = get_user_model() # Removes the django user from the django group user = UserModel._default_manager.get(email=document.email) group = Group.objects.get(name=document.tenant.slug) group.user_set.remove(user) group.save() # De-index document from Elastic Search es_document_deindex.delay(document)