diff --git a/model_utils/fields.py b/model_utils/fields.py index e04ada2b..10e22fa3 100644 --- a/model_utils/fields.py +++ b/model_utils/fields.py @@ -1,7 +1,6 @@ import secrets import uuid import warnings -from collections.abc import Callable from django.conf import settings from django.core.exceptions import ValidationError @@ -346,8 +345,8 @@ def __init__(self, editable=False, max_length=128, factory=None, **kwargs): non-callable value for factory is not supported. """ - if factory is not None and not isinstance(factory, Callable): - raise TypeError("'factory' should either be a callable not 'None'") + if factory is not None and not callable(factory): + raise TypeError("'factory' should either be a callable or 'None'") self._factory = factory kwargs.pop('default', None) # passing default value has not effect.