diff options
Diffstat (limited to 'lib/srtgui/views.py')
-rw-r--r-- | lib/srtgui/views.py | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/lib/srtgui/views.py b/lib/srtgui/views.py index db9e8fbc..d87dca38 100644 --- a/lib/srtgui/views.py +++ b/lib/srtgui/views.py @@ -1708,16 +1708,12 @@ def xhr_investigation_commit(request): priority = request.POST['priority'] defect_name = _create_defect(investigation,defect_reason,components) history_comment = "New defect '%s' created" % defect_name - if 'submit-trashdefect' == action: - defects = request.POST['defects'] + if 'submit-detachdefect' == action: + defect_name = request.POST['defect'] product_id = Investigation.objects.get(id=invst_id).product_id - defect_names = "" - for defect_id in defects.split(','): - defect_id = int(defect_id) - defect_names += Defect.objects.get(pk=defect_id).name + ", " - InvestigationToDefect.objects.get(investigation_id=invst_id, defect_id=defect_id).delete() - defect_names = defect_names[:-2] - history_comment = defect_names + " deleted from defects" + defect_id = Defect.objects.get(name=defect_name).id + InvestigationToDefect.objects.get(investigation_id=invst_id, defect_id=defect_id).delete() + history_comment = defect_name + " detached from investigation" if 'submit-newcomment' == action: comment = request.POST['comment'] InvestigationComments.objects.create(investigation_id=invst_id, comment=comment, date=datetime.today().strftime('%Y-%m-%d'), author=username) |