There are cases in which we have to receive a boolean value in params to fill up an object. I have came through an idea of doing this, following utility method will help you doing this:
def str2bool(value):
"""
convert string to bool
"""
if value:
return value.lower() in ("true",)
else:
return False
In your view: (Usage)
is_active = str2bool(self.request.query_params.get('active', 'true'))
You can have these kind of utility methods in your project to use them effectively. Kudos!