diff --git a/viewer/download_structures.py b/viewer/download_structures.py index 1ec33714..0a25850c 100644 --- a/viewer/download_structures.py +++ b/viewer/download_structures.py @@ -86,7 +86,7 @@ def __init__(self, category): query = SiteObservationTag.objects.filter( pk=Subquery( SiteObvsSiteObservationTag.objects.filter( - site_observation=OuterRef('pk'), + site_observation=OuterRef(OuterRef('pk')), site_obvs_tag__category=TagCategory.objects.get( category=category, ), diff --git a/viewer/target_loader.py b/viewer/target_loader.py index 2590f163..4e72cc8a 100644 --- a/viewer/target_loader.py +++ b/viewer/target_loader.py @@ -1875,7 +1875,9 @@ def _tag_observations(self, tag, prefix, category, so_list): so_group.save() try: - so_tag = SiteObservationTag.objects.get(upload_name=tag, target=self.target) + so_tag = SiteObservationTag.objects.get( + upload_name=f"{prefix} - {tag}", target=self.target + ) # Tag already exists # Apart from the new mol_group and molecules, we shouldn't be # changing anything.