Q:

Django view, using passed argument to dynamically set field to update

New to django and trying to pass an argument as the field to update however I get the error "keywords cant be an expression"
Is there a proper method of dynamically setting the field?
class UpdateUser(AtomicMixin, CreateModelMixin, GenericAPIView):
serializer_class = UserSerializer
authentication_classes = ()

def post(self, request):
    """User registration view."""
    User.objects.filter(id=request.data['userID']).update(request.data['fieldToUpdate']=request.data['value'])

    return Response("Saved", status=status.HTTP_200_OK)

A:

The way to dynamically set a keyword argument is to use dictionary expansion.
...update(**{request.data['fieldToUpdate']: request.data['value']})

