@@ -3767,13 +3767,15 @@ def __str__(self):
37673767
37683768 def clean (self ):
37693769 super ().clean ()
3770+ from dojo .risk_acceptance .helper import validate_findings_engagement
37703771 if self .pk :
3771- # Get all findings that do NOT belong to this engagement
3772- problematic_findings = self .accepted_findings .exclude (test__engagement = self .engagement )
3773- if problematic_findings .exists ():
3774- problematic_ids = list (problematic_findings .values_list ("id" , flat = True ))
3775- msg = f"Findings with IDs { problematic_ids } do not belong to engagement { self .engagement_id } ."
3776- raise ValidationError (msg )
3772+ validate_findings_engagement (self .engagement , self .accepted_findings .all ())
3773+ # # Get all findings that do NOT belong to this engagement
3774+ # problematic_findings = self.accepted_findings.exclude(test__engagement=self.engagement)
3775+ # if problematic_findings.exists():
3776+ # problematic_ids = list(problematic_findings.values_list("id", flat=True))
3777+ # msg = f"Findings with IDs {problematic_ids} do not belong to engagement {self.engagement_id}."
3778+ # raise ValidationError(msg)
37773779
37783780 def filename (self ):
37793781 # logger.debug('path: "%s"', self.path)
@@ -3788,8 +3790,7 @@ def name_and_expiration_info(self):
37883790 def get_breadcrumbs (self ):
37893791 bc = self .engagement .get_breadcrumbs ()
37903792 bc += [{"title" : str (self ),
3791- "url" : reverse ("view_risk_acceptance" , args = (
3792- self .engagement .product .id , self .id ))}]
3793+ "url" : reverse ("view_risk_acceptance" , args = (self .id , ))}]
37933794 return bc
37943795
37953796 @property
0 commit comments