mirror of
https://github.com/SectorLabs/django-localized-fields.git
synced 2025-10-29 18:18:57 +03:00
Allow raw dicts to be used in update statements
This commit is contained in:
@@ -131,6 +131,8 @@ class LocalizedField(HStoreField):
|
||||
specified, we'll treat it as an empty :see:LocalizedValue
|
||||
instance, on which the validation will fail.
|
||||
|
||||
Dictonaries are converted into :see:LocalizedValue instances.
|
||||
|
||||
Arguments:
|
||||
value:
|
||||
The :see:LocalizedValue instance to serialize
|
||||
@@ -141,6 +143,9 @@ class LocalizedField(HStoreField):
|
||||
extracted from the specified value.
|
||||
"""
|
||||
|
||||
if isinstance(value, dict):
|
||||
value = LocalizedValue(value)
|
||||
|
||||
# default to None if this is an unknown type
|
||||
if not isinstance(value, LocalizedValue) and value:
|
||||
value = None
|
||||
|
||||
Reference in New Issue
Block a user