diff --git a/bijoe/schemas.py b/bijoe/schemas.py
index 1b4afda..c63e3b2 100644
--- a/bijoe/schemas.py
+++ b/bijoe/schemas.py
@@ -415,7 +415,7 @@ class Cube(Base):
class Warehouse(Base):
- __slots__ = ['name', 'slug', 'label', 'pg_dsn', 'search_path', 'cubes', 'path']
+ __slots__ = ['name', 'slug', 'label', 'pg_dsn', 'search_path', 'cubes', 'path', 'timestamp']
__types__ = {
'name': str,
'slug': str,
@@ -429,6 +429,7 @@ class Warehouse(Base):
def __init__(self, **kwargs):
self.path = None
self.slug = None
+ self.timestamp = None
super(Warehouse, self).__init__(**kwargs)
def check(self):
diff --git a/bijoe/templates/bijoe/cube.html b/bijoe/templates/bijoe/cube.html
index b0b7845..1d0bf28 100644
--- a/bijoe/templates/bijoe/cube.html
+++ b/bijoe/templates/bijoe/cube.html
@@ -71,6 +71,7 @@
{% trans "Save" %}
{% endblock %}
+
{% trans "Last update" %} {{ warehouse.timestamp }}
{% else %}
{% trans "Please choose some measures and groupings." %}
{% endif %}
diff --git a/bijoe/templates/bijoe/homepage.html b/bijoe/templates/bijoe/homepage.html
index 2fe0b01..5463cb4 100644
--- a/bijoe/templates/bijoe/homepage.html
+++ b/bijoe/templates/bijoe/homepage.html
@@ -28,7 +28,9 @@
{% endif %}
diff --git a/bijoe/templates/bijoe/warehouse.html b/bijoe/templates/bijoe/warehouse.html
index 6625292..7e4f34f 100644
--- a/bijoe/templates/bijoe/warehouse.html
+++ b/bijoe/templates/bijoe/warehouse.html
@@ -12,6 +12,7 @@
{% endblock %}
{% block content %}
+ {% trans "Last update " %} {{ warehouse.timestamp }}
diff --git a/bijoe/utils.py b/bijoe/utils.py
index dcc3543..2680f5c 100644
--- a/bijoe/utils.py
+++ b/bijoe/utils.py
@@ -14,6 +14,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see .
+import datetime
import os
import glob
import json
@@ -21,6 +22,8 @@ import json
from django.conf import settings
from django.db import connection, transaction
from django.utils.translation import ugettext as _
+from django.utils.timezone import utc
+
try:
from functools import lru_cache
except ImportError:
@@ -41,8 +44,10 @@ def get_warehouses_paths():
@lru_cache()
def get_warehouse_by_path_and_mtime(path, mtime):
- warehouse = json.load(open(path))
+ with open(path) as fd:
+ warehouse = json.load(fd)
warehouse['path'] = path
+ warehouse['timestamp'] = mtime
return Warehouse.from_json(warehouse)