Example #1
0
File: views.py Project: aeud/sing
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)
Example #2
0
File: models.py Project: aeud/sing
 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
Example #3
0
File: views.py Project: aeud/sing
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)
Example #4
0
 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
Example #5
0
File: views.py Project: aeud/sing
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)
Example #6
0
File: views.py Project: aeud/sing
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)
Example #7
0
File: views.py Project: aeud/sing
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)
Example #8
0
File: views.py Project: aeud/sing
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)