LocalizedAutoSlugField should only warn about deprecation if used

This commit is contained in:
Swen Kooij 2021-11-08 15:08:08 +02:00
parent 0f30cc1493
commit cc911d4909

View File

@ -16,14 +16,14 @@ from .field import LocalizedField
class LocalizedAutoSlugField(LocalizedField): class LocalizedAutoSlugField(LocalizedField):
"""Automatically provides slugs for a localized field upon saving.""" """Automatically provides slugs for a localized field upon saving."""
def __init__(self, *args, **kwargs):
"""Initializes a new instance of :see:LocalizedAutoSlugField."""
warnings.warn( warnings.warn(
"LocalizedAutoSlug is deprecated and will be removed in the next major version.", "LocalizedAutoSlug is deprecated and will be removed in the next major version.",
DeprecationWarning, DeprecationWarning,
) )
def __init__(self, *args, **kwargs):
"""Initializes a new instance of :see:LocalizedAutoSlugField."""
self.populate_from = kwargs.pop("populate_from", None) self.populate_from = kwargs.pop("populate_from", None)
self.include_time = kwargs.pop("include_time", False) self.include_time = kwargs.pop("include_time", False)