Beispiel #1
0
def delete_dictionary(request, project, lang, pk):
    prj = get_project(request, project)
    if not can_delete_dictionary(request.user, prj):
        raise PermissionDenied()

    lang = get_object_or_404(Language, code=lang)
    word = get_object_or_404(
        Dictionary,
        project=prj,
        language=lang,
        id=pk
    )

    word.delete()

    params = {}
    for param in ('letter', 'limit', 'page'):
        if param in request.POST:
            params[param] = request.POST[param]

    if params:
        param = '?' + urlencode(params)
    else:
        param = ''

    return redirect_param(
        'show_dictionary',
        param,
        project=prj.slug,
        lang=lang.code
    )
Beispiel #2
0
def delete_dictionary(request, project, lang, pk):
    prj = get_project(request, project)
    if not can_delete_dictionary(request.user, prj):
        raise PermissionDenied()

    lang = get_object_or_404(Language, code=lang)
    word = get_object_or_404(Dictionary, project=prj, language=lang, id=pk)

    word.delete()

    return redirect('show_dictionary', project=prj.slug, lang=lang.code)
Beispiel #3
0
def delete_dictionary(request, project, lang, pk):
    prj = get_project(request, project)
    if not can_delete_dictionary(request.user, prj):
        raise PermissionDenied()

    lang = get_object_or_404(Language, code=lang)
    word = get_object_or_404(
        Dictionary,
        project=prj,
        language=lang,
        id=pk
    )

    word.delete()

    return redirect(
        'show_dictionary',
        project=prj.slug,
        lang=lang.code
    )