Why not `if request.toolbar.edit_mode`?
Other than that looks good. I'll have a spin at it later