def edit_priority(request, pk): """ Change source string priority. """ source = get_object_or_404(Source, pk=pk) form = PriorityForm(request.POST) if form.is_valid(): source.priority = form.cleaned_data['priority'] source.save() else: messages.error(request, _('Failed to change a priority!')) return redirect(request.POST.get('next', source.get_absolute_url()))
def edit_priority(request, pk): """ Change source string priority. """ source = get_object_or_404(Source, pk=pk) form = PriorityForm(request.POST) if form.is_valid(): source.priority = form.cleaned_data['priority'] source.save() else: messages.error(request, _('Failed to change a priority!')) return redirect(request.POST.get('next', source.get_absolute_url()))
def edit_priority(request, pk): """Change source string priority.""" source = get_object_or_404(Source, pk=pk) if not request.user.has_perm('source.edit', source.component): raise PermissionDenied() form = PriorityForm(request.POST) if form.is_valid(): source.priority = form.cleaned_data['priority'] source.save() else: messages.error(request, _('Failed to change a priority!')) return redirect_next(request.POST.get('next'), source.get_absolute_url())
def edit_priority(request, pk): """Change source string priority.""" source = get_object_or_404(Source, pk=pk) if not can_edit_priority(request.user, source.subproject.project): raise PermissionDenied() form = PriorityForm(request.POST) if form.is_valid(): source.priority = form.cleaned_data['priority'] source.save() else: messages.error(request, _('Failed to change a priority!')) return redirect_next(request.POST.get('next'), source.get_absolute_url())