mirror of
https://github.com/SectorLabs/django-localized-fields.git
synced 2025-10-29 18:18:57 +03:00
Add flag to disable LocalizedUniqueSlugField
This commit is contained in:
@@ -32,6 +32,7 @@ class LocalizedUniqueSlugField(LocalizedAutoSlugField):
|
||||
|
||||
kwargs["uniqueness"] = kwargs.pop("uniqueness", get_language_codes())
|
||||
|
||||
self.enabled = kwargs.pop("enabled", True)
|
||||
self.immutable = kwargs.pop("immutable", False)
|
||||
|
||||
super(LocalizedUniqueSlugField, self).__init__(*args, **kwargs)
|
||||
@@ -69,6 +70,9 @@ class LocalizedUniqueSlugField(LocalizedAutoSlugField):
|
||||
The localized slug that was generated.
|
||||
"""
|
||||
|
||||
if not self.enabled:
|
||||
return getattr(instance, self.name)
|
||||
|
||||
if not isinstance(instance, AtomicSlugRetryMixin):
|
||||
raise ImproperlyConfigured(
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user