mirror of
https://github.com/SectorLabs/django-localized-fields.git
synced 2025-06-26 21:33:19 +03:00
LocalizedUniqueSlugField should properly deconstruct 'enabled' flag
This commit is contained in:
parent
d57f9a41bb
commit
1b3e5989d3
@ -50,6 +50,9 @@ class LocalizedUniqueSlugField(LocalizedAutoSlugField):
|
||||
kwargs["populate_from"] = self.populate_from
|
||||
kwargs["include_time"] = self.include_time
|
||||
|
||||
if self.enabled is False:
|
||||
kwargs["enabled"] = self.enabled
|
||||
|
||||
if self.immutable is True:
|
||||
kwargs["immutable"] = self.immutable
|
||||
|
||||
|
@ -297,10 +297,13 @@ class LocalizedSlugFieldTestCase(TestCase):
|
||||
"""Tests whether the :see:deconstruct function properly retains options
|
||||
specified in the constructor."""
|
||||
|
||||
field = LocalizedUniqueSlugField(populate_from="title")
|
||||
field = LocalizedUniqueSlugField(
|
||||
enabled=False, immutable=True, populate_from="title"
|
||||
)
|
||||
_, _, _, kwargs = field.deconstruct()
|
||||
|
||||
assert "populate_from" in kwargs
|
||||
assert not kwargs["enabled"]
|
||||
assert kwargs["immutable"]
|
||||
assert kwargs["populate_from"] == field.populate_from
|
||||
|
||||
@staticmethod
|
||||
|
Loading…
x
Reference in New Issue
Block a user