def v_import_post(request): array = json.loads(request.POST.get('file')) for v in array: visualization = Visualization.new_from_dict(request, v) if len(array) == 1: return redirect(show, visualization_id=visualization.id) return redirect(index)
def new_from_dict(request, dashboard, e): entity = DashboardEntity(size=e.get('size'), position=e.get('position'), dashboard=dashboard, visualization=Visualization.new_from_dict(request, e.get('visualization'))) entity.save() return entity
def new_from_dict(request, dashboard, e): entity = DashboardEntity(size=e.get('size'), position=e.get('position'), dashboard=dashboard, visualization=Visualization.new_from_dict( request, e.get('visualization'))) entity.save() return entity
def create(request): visualization = Visualization( name=request.POST.get('name'), description=request.POST.get('description'), account=request.user.account, created_by=request.user, ) if request.POST.get('cache_for'): visualization.cache_for = int(request.POST.get('cache_for')) visualization.cache_until = None elif request.POST.get('cache_until'): visualization.cache_for = None visualization.cache_until = request.POST.get('cache_until') else: visualization.cache_for = None visualization.cache_until = None visualization.save() return redirect(query, visualization_id=visualization.id)
def create(request): visualization = Visualization(name=request.POST.get('name'), description=request.POST.get('description'), account=request.user.account, created_by=request.user,) if request.POST.get('cache_for'): visualization.cache_for = int(request.POST.get('cache_for')) visualization.cache_until = None elif request.POST.get('cache_until'): visualization.cache_for = None visualization.cache_until = request.POST.get('cache_until') else: visualization.cache_for = None visualization.cache_until = None visualization.save() return redirect(query, visualization_id=visualization.id)
def duplicate(request, visualization_id): visualization = get_object_or_404(Visualization, pk=visualization_id, account=request.user.account) new_visualization = Visualization.duplicate(request, visualization) return redirect(edit, visualization_id=new_visualization.id)