mirror of
https://github.com/SectorLabs/django-localized-fields.git
synced 2025-04-24 19:32:53 +03:00
Merge pull request #60 from AdrianMuntean/error_on_empty_localized_integer_field
Return empty string in case the LocalizedIntegerField is null
This commit is contained in:
commit
151250505d
@ -279,7 +279,7 @@ Besides ``LocalizedField``, there's also:
|
|||||||
|
|
||||||
Allows storing integers in multiple languages. This works exactly like ``LocalizedField`` except that
|
Allows storing integers in multiple languages. This works exactly like ``LocalizedField`` except that
|
||||||
all values must be integers. Do note that values are stored as strings in your database because
|
all values must be integers. Do note that values are stored as strings in your database because
|
||||||
the backing field type is ``hstore``, which only allows storing integers. The ``LocalizedIntegerField``
|
the backing field type is ``hstore``, which only allows storing strings. The ``LocalizedIntegerField``
|
||||||
takes care of ensuring that all values are integers and converts the stored strings back to integers
|
takes care of ensuring that all values are integers and converts the stored strings back to integers
|
||||||
when retrieving them from the database. Do not expect to be able to do queries such as:
|
when retrieving them from the database. Do not expect to be able to do queries such as:
|
||||||
|
|
||||||
|
@ -233,4 +233,4 @@ class LocalizedIntegerValue(LocalizedValue):
|
|||||||
"""Returns string representation of value"""
|
"""Returns string representation of value"""
|
||||||
|
|
||||||
value = self.translate()
|
value = self.translate()
|
||||||
return str(value) if value is not None else None
|
return str(value) if value is not None else ''
|
||||||
|
Loading…
x
Reference in New Issue
Block a user