Commits

Dima Moroz committed c12656a

Fixed an issue with ColumnDefault(val), when default argument passed to sqlalchemy column is just a plain value, not callable.

  • Participants
  • Parent commits c124036

Comments (0)

Files changed (1)

wtforms/ext/sqlalchemy/orm.py

                 # 'arg' that's callable.
                 callable_default = getattr(default, 'arg', None)
 
-                if callable_default and callable(callable_default):
-                    default = callable_default(None)
+                if callable_default is not None:
+                    # ColumnDefault(val).arg can be also a plain value
+                    default = callable_default(None) if callable(callable_default) else callable_default
+
             kwargs['default'] = default
 
             if column.nullable: