Exemple #1
0
def edit_check_flags(request, pk):
    """
    Change source string check flags.
    """
    source = get_object_or_404(Source, pk=pk)
    form = CheckFlagsForm(request.POST)
    if form.is_valid():
        source.check_flags = form.cleaned_data['flags']
        source.save()
    else:
        messages.error(request, _('Failed to change check flags!'))
    return redirect(request.POST.get('next', source.get_absolute_url()))
Exemple #2
0
def edit_check_flags(request, pk):
    """Change source string flags."""
    source = get_object_or_404(Source, pk=pk)

    if not request.user.has_perm('source.edit', source.component):
        raise PermissionDenied()

    form = CheckFlagsForm(request.POST)
    if form.is_valid():
        source.check_flags = form.cleaned_data['flags']
        source.save()
    else:
        messages.error(request, _('Failed to change translation flags!'))
    return redirect_next(request.POST.get('next'), source.get_absolute_url())
Exemple #3
0
def edit_check_flags(request, pk):
    """Change source string check flags."""
    source = get_object_or_404(Source, pk=pk)

    if not can_edit_flags(request.user, source.subproject.project):
        raise PermissionDenied()

    form = CheckFlagsForm(request.POST)
    if form.is_valid():
        source.check_flags = form.cleaned_data['flags']
        source.save()
    else:
        messages.error(request, _('Failed to change check flags!'))
    return redirect_next(request.POST.get('next'), source.get_absolute_url())