def test_serialize_settings(self): self.assertSerializedEqual( SettingsReference(settings.AUTH_USER_MODEL, "AUTH_USER_MODEL")) self.assertSerializedResultEqual( SettingsReference("someapp.model", "AUTH_USER_MODEL"), ("settings.AUTH_USER_MODEL", {"from django.conf import settings"}), )
def deconstruct(self): name, path, args, kwargs = super().deconstruct() kwargs["to_field"] = SettingsReference( getattr(settings, self.setting_name, "id"), self.setting_name) if "help_text" in kwargs: del kwargs["help_text"] return name, path, args, kwargs
def deconstruct(self): name, path, args, kwargs = super().deconstruct() kwargs["to_field"] = SettingsReference( getattr(settings, self.setting_name, "id"), self.setting_name) return name, path, args, kwargs