From cf4538ca0233932763c4fdc4e1c981ef7e8666c0 Mon Sep 17 00:00:00 2001 From: wes Date: Sun, 3 Nov 2013 13:07:55 -0700 Subject: [PATCH] Correct handling of boolean field types in utils.py --- flask_peewee/utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/flask_peewee/utils.py b/flask_peewee/utils.py index d8d60de..00919e9 100644 --- a/flask_peewee/utils.py +++ b/flask_peewee/utils.py @@ -11,6 +11,7 @@ from peewee import ForeignKeyField from peewee import Model from peewee import SelectQuery +from peewee import BooleanField def get_object_or_404(query_or_model, *query): @@ -111,6 +112,8 @@ def get_model_from_dictionary(model, field_dict): models.extend(rel_models) setattr(model_instance, field_name, rel_inst) else: + if isinstance(model_instance._meta.fields[field_name], BooleanField): + value = value == "True" setattr(model_instance, field_name, field_obj.python_value(value)) return model_instance, models