summaryrefslogtreecommitdiff
path: root/ishtar_common/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/utils.py')
-rw-r--r--ishtar_common/utils.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/ishtar_common/utils.py b/ishtar_common/utils.py
index e0a670d56..35289145c 100644
--- a/ishtar_common/utils.py
+++ b/ishtar_common/utils.py
@@ -31,6 +31,7 @@ from jinja2 import Template
from jinja2.filters import FILTERS, environmentfilter
import locale
import math
+import numpy
import os
import random
import re
@@ -1224,6 +1225,21 @@ def _post_save_geo(sender, **kwargs):
return
+def format_int_float(values):
+ """
+ Numpy array: format integer with not "."
+ """
+ new_values = []
+ for value in values:
+ if numpy.isnan(value):
+ new_values.append("")
+ elif int(value) == value:
+ new_values.append(str(int(value)))
+ else:
+ new_values.append(value)
+ return new_values
+
+
def create_slug(model, name, slug_attr="slug", max_length=100):
base_slug = slugify(name)
slug = base_slug[:max_length]