mirror of
https://github.com/Hopiu/django-model-utils.git
synced 2026-03-16 20:00:23 +00:00
Merge pull request #607 from ProtixIT/cleanup-factory
Minor cleanup of the code handling `UrlsafeTokenField`'s `factory` argument
This commit is contained in:
commit
89653b2d24
1 changed files with 2 additions and 3 deletions
|
|
@ -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 @@ class UrlsafeTokenField(models.CharField):
|
|||
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.
|
||||
|
|
|
|||
Loading…
Reference in a new issue