Exemplo n.º 1
0
def delete_design(request):
    if request.method == 'POST':
        ids = request.POST.getlist('designs_selection')
        designs = dict([(design_id,
                         authorized_get_design(request,
                                               design_id,
                                               owner_only=True))
                        for design_id in ids])

        if None in list(designs.values()):
            LOG.error('Cannot delete non-existent design(s) %s' % ','.join(
                [key for key, name in list(designs.items()) if name is None]))
            return list_designs(request)

        for design in list(designs.values()):
            if request.POST.get('skipTrash', 'false') == 'false':
                design.doc.get().send_to_trash()
            else:
                design.doc.all().delete()
                design.delete()
        return redirect(reverse(get_app_name(request) + ':list_designs'))
    else:
        return render('confirm.mako', request, {
            'url': request.path,
            'title': _('Delete design(s)?')
        })
Exemplo n.º 2
0
Arquivo: views.py Projeto: anutron/hue
def delete_design(request, design_id):
  """Delete a saved design"""
  try:
    design = models.SavedQuery.get(design_id, request.user)
  except models.SavedQuery.DoesNotExist:
    LOG.error('Cannot delete non-existent design %s' % (design_id,))
    return list_designs(request)

  if request.method == 'POST':
    design.delete()
    return list_designs(request)
  else:
    return render('confirm.html', request, dict(url=request.path, title='Delete design?'))
Exemplo n.º 3
0
def delete_design(request, design_id):
  """Delete a saved design"""
  design = authorized_get_design(request, design_id)

  if design is None:
    LOG.error('Cannot delete non-existent design %s' % (design_id,))
    return list_designs(request)

  if request.method == 'POST':
    design.delete()
    return redirect(urlresolvers.reverse(list_designs))
  else:
    return render('confirm.html', request, dict(url=request.path, title='Delete design?'))
Exemplo n.º 4
0
def delete_design(request):
  if request.method == 'POST':
    ids = request.POST.getlist('designs_selection')
    designs = dict([(design_id, authorized_get_design(request, design_id)) for design_id in ids])

    if None in designs.values():
      LOG.error('Cannot delete non-existent design(s) %s' % ','.join([key for key, name in designs.items() if name is None]))
      return list_designs(request)
    for design in designs.values():
      design.delete()
    return redirect(reverse(get_app_name(request) + ':list_designs'))
  else:
    return render('confirm.html', request, dict(url=request.path, title=_('Delete design(s)?')))
Exemplo n.º 5
0
def delete_design(request):
  if request.method == 'POST':
    ids = request.POST.getlist('designs_selection')
    designs = dict([(design_id, authorized_get_design(request, design_id)) for design_id in ids])

    if None in designs.values():
      LOG.error('Cannot delete non-existent design(s) %s' % ','.join([key for key, name in designs.items() if name is None]))
      return list_designs(request)
    for design in designs.values():
      design.delete()
    return redirect(reverse(get_app_name(request) + ':list_designs'))
  else:
    return render('confirm.html', request, dict(url=request.path, title=_('Delete design(s)?')))
Exemplo n.º 6
0
def delete_design(request):
    if request.method == "POST":
        ids = request.POST.getlist("designs_selection")
        designs = dict([(design_id, authorized_get_design(request, design_id)) for design_id in ids])

        if None in designs.values():
            LOG.error(
                "Cannot delete non-existent design(s) %s"
                % ",".join([key for key, name in designs.items() if name is None])
            )
            return list_designs(request)
        for design in designs.values():
            design.delete()
        return redirect(reverse(get_app_name(request) + ":list_designs"))
    else:
        return render("confirm.html", request, dict(url=request.path, title=_("Delete design(s)?")))
Exemplo n.º 7
0
def delete_design(request):
  if request.method == 'POST':
    ids = request.POST.getlist('designs_selection')
    designs = dict([(design_id, authorized_get_design(request, design_id, owner_only=True)) for design_id in ids])

    if None in designs.values():
      LOG.error('Cannot delete non-existent design(s) %s' % ','.join([key for key, name in designs.items() if name is None]))
      return list_designs(request)

    for design in designs.values():
      if request.POST.get('skipTrash', 'false') == 'false':
        design.doc.get().send_to_trash()
      else:
        design.doc.all().delete()
        design.delete()
    return redirect(reverse(get_app_name(request) + ':list_designs'))
  else:
    return render('confirm.mako', request, {'url': request.path, 'title': _('Delete design(s)?')})
Exemplo n.º 8
0
def delete_design(request):
    if request.method == "POST":
        ids = request.POST.getlist("designs_selection")
        designs = dict([(design_id, authorized_get_design(request, design_id, owner_only=True)) for design_id in ids])

        if None in designs.values():
            LOG.error(
                "Cannot delete non-existent design(s) %s"
                % ",".join([key for key, name in designs.items() if name is None])
            )
            return list_designs(request)

        for design in designs.values():
            if request.POST.get("skipTrash", "false") == "false":
                design.doc.get().send_to_trash()
            else:
                design.doc.all().delete()
                design.delete()
        return redirect(reverse(get_app_name(request) + ":list_designs"))
    else:
        return render("confirm.mako", request, {"url": request.path, "title": _("Delete design(s)?")})