scripts: populate warehouse_slug visualization parameter (#38596)
This commit is contained in:
parent
ebb9cb3e39
commit
f93d42834e
|
@ -1,3 +1,4 @@
|
|||
COPYING
|
||||
README.rst
|
||||
debian/nginx-example.conf
|
||||
debian/scripts/warehouse_slug.py
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
"""
|
||||
In order to allow for import/export between instances, warehouses are now
|
||||
retrieved by slug and not by name.
|
||||
This new information is available in the model files, but for existing
|
||||
visualizations it should be manually added, using this script.
|
||||
For a standard multitenants install, it can be ran using the command :
|
||||
sudo -u bijoe bijoe-manage tenant_command runscript --all-tenants /usr/share/doc/bijoe/warehouse_slug.py
|
||||
"""
|
||||
|
||||
from bijoe.utils import get_warehouses
|
||||
from bijoe.visualization.models import Visualization
|
||||
|
||||
|
||||
warehouses = get_warehouses()
|
||||
for visu in Visualization.objects.all():
|
||||
for warehouse in warehouses:
|
||||
if warehouse.name == visu.parameters['warehouse']:
|
||||
visu.parameters['warehouse_slug'] = warehouse.slug
|
||||
visu.save()
|
||||
break
|
Loading…
Reference in New Issue