I have a CreateAPIView view with this code in the serializer:

class AssignWorkItemSerializer(serializers.Serializer, WorkitemSerializerMixin):
    assigneeIds = serializers.ListSerializer(
        child=serializers.PrimaryKeyRelatedField(
            
queryset=get_user_model().objects.filter(userrole__role__name='analyst')
        ),
        source='assignees'
    )

This is failing because that query returns multiple rows. I want to
filter that queryset at run time by something that is available to me
in the request. Is there a way to do that?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACwCsY46gZEjH9YNajSx%2B2uSSzozC7S_up9KY%3DB655p4zFL-Yg%40mail.gmail.com.

Reply via email to