diff --git a/beat/web/utils/management/commands/install.py b/beat/web/utils/management/commands/install.py index e5f753cfa1a5e009de3c7002cb5b3c7532cdfc9e..f1d85e3239cb6997734ae5f49417434bda3b6c3a 100755 --- a/beat/web/utils/management/commands/install.py +++ b/beat/web/utils/management/commands/install.py @@ -678,6 +678,12 @@ def upload_plotter(prefix, name, data): version=int(storage.version), ) + sample_data_file_location = prefix + "/plotters/" + name.split("/")[0] + "/" + \ + name.split("/")[1] + "/sample_data.txt" + + with open(sample_data_file_location) as sample_data_file: + sample_data = simplejson.load(sample_data_file) + if not plotter: (plotter, errors) = Plotter.objects.create_plotter( author=author, @@ -692,6 +698,8 @@ def upload_plotter(prefix, name, data): logger.warn("Did not add plotter `%s', because: %s", name, errors) return False else: + plotter.sample_data = simplejson.dumps(sample_data, indent=4) + plotter.save() logger.info("Added plotter `%s'", plotter) else: #only updates documentation @@ -701,6 +709,7 @@ def upload_plotter(prefix, name, data): plotter.declaration = declaration plotter.description = description plotter.code = code + plotter.sample_data = simplejson.dumps(sample_data, indent=4) plotter.save() logger.info("Updated plotter `%s'", plotter)