Skip to content

Commit

Permalink
fix: PUT request to siteobservationtag view now modifies group (issue…
Browse files Browse the repository at this point in the history
… 1189)
  • Loading branch information
kaliif committed Oct 26, 2023
1 parent 6236d8f commit 6c9ae6c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
9 changes: 9 additions & 0 deletions viewer/serializers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import logging
from urllib.parse import urljoin

from django.db.models import F
Expand Down Expand Up @@ -28,6 +29,8 @@

from viewer.target_set_upload import sanitize_mol

logger = logging.getLogger(__name__)

_ISPYB_SAFE_QUERY_SET = ISpyBSafeQuerySet()


Expand Down Expand Up @@ -648,6 +651,12 @@ class Meta:


class SiteObservationTagSerializer(serializers.ModelSerializer):

site_observations = serializers.PrimaryKeyRelatedField(
many=True,
queryset=models.SiteObservation.objects.all()
)

class Meta:
model = models.SiteObservationTag
fields = '__all__'
Expand Down
10 changes: 5 additions & 5 deletions viewer/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1206,23 +1206,23 @@ def create(self, request):
class TagCategoryView(viewsets.ModelViewSet):
"""Set up and retrieve information about tag categories (api/tag_category).
"""
queryset = models.TagCategory.objects.filter()
queryset = models.TagCategory.objects.all()
serializer_class = serializers.TagCategorySerializer
filterset_fields = ('id', 'category')


class SiteObservationTagView(viewsets.ModelViewSet):
"""Set up/retrieve information about tags relating to Molecules (api/molecule_tag)
"""
queryset = models.SiteObservationTag.objects.filter()
queryset = models.SiteObservationTag.objects.all()
serializer_class = serializers.SiteObservationTagSerializer
filterset_fields = ('id', 'tag', 'category', 'target', 'site_observations', 'mol_group')


class SessionProjectTagView(viewsets.ModelViewSet):
"""Set up/retrieve information about tags relating to Session Projects.
"""
queryset = models.SessionProjectTag.objects.filter()
queryset = models.SessionProjectTag.objects.all()
serializer_class = serializers.SessionProjectTagSerializer
filterset_fields = ('id', 'tag', 'category', 'target', 'session_projects')

Expand All @@ -1232,7 +1232,7 @@ class TargetMoleculesView(ISpyBSafeQuerySet):
to a Target. The idea is that a single call can return all target related
information needed by the React front end in a single call.
"""
queryset = models.Target.objects.filter()
queryset = models.Target.objects.all()
serializer_class = serializers.TargetMoleculesSerializer
filter_permissions = "project_id"
filterset_fields = ("title",)
Expand All @@ -1245,7 +1245,7 @@ class DownloadStructures(ISpyBSafeQuerySet):
Note that old zip files are removed after one hour.
"""
queryset = models.Target.objects.filter()
queryset = models.Target.objects.all()
serializer_class = serializers.DownloadStructuresSerializer
filter_permissions = "project_id"
filterset_fields = ('title','id')
Expand Down

0 comments on commit 6c9ae6c

Please sign in to comment.