Improve tag handling in importers and add tests for tag imports#13650
Improve tag handling in importers and add tests for tag imports#13650
Conversation
…r additional tags
valentijnscholten
left a comment
There was a problem hiding this comment.
Approved. What is the reason this PR fixes the/a problem? Is it that finding.tags = clean_tags(finding.unsaved_tags) doesn't work but finding.tags.set( clean_tags(finding.unsaved_tags)) does?
Yes. In previous versions, the tags were set before the finding was saved for the first time, so the tags would be applied normally. In today's version, the tags are set after the finding is saved, but not in the same way the other m2m relationships are managed. Since we only save the finding once in the importer now, we can't just set the tags attribute any longer. We have to use add/set in the m2m manager |
Improve tag handling in importers and add tests for tag imports
Enhance the tag processing logic in the DefaultImporter to correctly handle both lists and strings of tags. Introduce unit tests to verify the import functionality for reports containing tags.