@@ -2016,20 +2016,20 @@ class async_delete:
20162016 def __init__ (self , * args , ** kwargs ):
20172017 self .mapping = {
20182018 "Product_Type" : [
2019- (Endpoint , "product__prod_type " ),
2020- (Finding , "test__engagement__product__prod_type " ),
2021- (Test , "engagement__product__prod_type " ),
2022- (Engagement , "product__prod_type " ),
2023- (Product , "prod_type " )],
2019+ (Endpoint , "product__prod_type__id " ),
2020+ (Finding , "test__engagement__product__prod_type__id " ),
2021+ (Test , "engagement__product__prod_type__id " ),
2022+ (Engagement , "product__prod_type__id " ),
2023+ (Product , "prod_type__id " )],
20242024 "Product" : [
2025- (Endpoint , "product " ),
2026- (Finding , "test__engagement__product " ),
2027- (Test , "engagement__product " ),
2028- (Engagement , "product " )],
2025+ (Endpoint , "product__id " ),
2026+ (Finding , "test__engagement__product__id " ),
2027+ (Test , "engagement__product__id " ),
2028+ (Engagement , "product__id " )],
20292029 "Engagement" : [
2030- (Finding , "test__engagement " ),
2031- (Test , "engagement " )],
2032- "Test" : [(Finding , "test " )],
2030+ (Finding , "test__engagement__id " ),
2031+ (Test , "engagement__id " )],
2032+ "Test" : [(Finding , "test__id " )],
20332033 }
20342034
20352035 @dojo_async_task
@@ -2098,11 +2098,11 @@ def delete(self, obj, **kwargs):
20982098 @app .task
20992099 def crawl (self , obj , model_list , ** kwargs ):
21002100 logger .debug ("ASYNC_DELETE: Crawling " + self .get_object_name (obj ) + ": " + str (obj ))
2101- task_results = []
21022101 for model_info in model_list :
2102+ task_results = []
21032103 model = model_info [0 ]
21042104 model_query = model_info [1 ]
2105- filter_dict = {model_query : obj }
2105+ filter_dict = {model_query : obj . id }
21062106 # Only fetch the IDs since we will make a list of IDs in the following function call
21072107 objects_to_delete = model .objects .only ("id" ).filter (** filter_dict ).distinct ().order_by ("id" )
21082108 logger .debug ("ASYNC_DELETE: Deleting " + str (len (objects_to_delete )) + " " + self .get_object_name (model ) + "s in chunks" )
@@ -2116,11 +2116,11 @@ def crawl(self, obj, model_list, **kwargs):
21162116 # Wait for all chunk deletions to complete (they run in parallel)
21172117 for task_result in task_results :
21182118 task_result .get (timeout = 300 ) # 5 minute timeout per chunk
2119- # Now delete the main object after all chunks are done
2120- result = self .delete_chunk ([obj ])
2121- # Wait for final deletion to complete
2122- if hasattr (result , "get" ):
2123- result .get (timeout = 300 ) # 5 minute timeout
2119+ # Now delete the main object after all chunks are done
2120+ result = self .delete_chunk ([obj ])
2121+ # Wait for final deletion to complete
2122+ if hasattr (result , "get" ):
2123+ result .get (timeout = 300 ) # 5 minute timeout
21242124 logger .debug ("ASYNC_DELETE: Successfully deleted " + self .get_object_name (obj ) + ": " + str (obj ))
21252125
21262126 def chunk_list (self , model , full_list ):
0 commit comments