Fixed TOMLField defaults, and bumped version + dependencies
This commit is contained in:
parent
5a5e8b3fad
commit
668c5a2ede
|
|
@ -16,7 +16,7 @@ class TOMLFormField( fields.JSONField ):
|
||||||
"invalid": "Enter a valid TOML.",
|
"invalid": "Enter a valid TOML.",
|
||||||
}
|
}
|
||||||
|
|
||||||
widget = Codearea( language = "ini" )
|
widget = Codearea( language = "toml" )
|
||||||
|
|
||||||
def to_python(self, value):
|
def to_python(self, value):
|
||||||
if self.disabled: return value
|
if self.disabled: return value
|
||||||
|
|
@ -52,6 +52,11 @@ class TOMLField( models.JSONField ):
|
||||||
empty_strings_allowed = True
|
empty_strings_allowed = True
|
||||||
description = "A TOML Field"
|
description = "A TOML Field"
|
||||||
|
|
||||||
|
def __init__(self, **kwargs ):
|
||||||
|
kwargs.setdefault('default', tomlkit.document)
|
||||||
|
kwargs.setdefault('blank', True)
|
||||||
|
super().__init__( **kwargs )
|
||||||
|
|
||||||
def from_db_value(self, *args, **kwargs):
|
def from_db_value(self, *args, **kwargs):
|
||||||
value_as_dict = super().from_db_value(*args, **kwargs)
|
value_as_dict = super().from_db_value(*args, **kwargs)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,8 @@ class Codearea( Textarea ):
|
||||||
tab_size = 4,
|
tab_size = 4,
|
||||||
**kwargs
|
**kwargs
|
||||||
):
|
):
|
||||||
|
if language == "toml": language = "ini"
|
||||||
|
|
||||||
self.language = language
|
self.language = language
|
||||||
self.spell_check = spell_check
|
self.spell_check = spell_check
|
||||||
self.extra_rows = extra_rows
|
self.extra_rows = extra_rows
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user